-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make LlamaCppTokenizer an outlines Tokenizer
- Loading branch information
Showing
5 changed files
with
165 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from importlib import reload | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def temp_cache_dir(): | ||
import os | ||
import tempfile | ||
|
||
import outlines.caching | ||
import outlines.fsm.guide | ||
|
||
with tempfile.TemporaryDirectory() as tempdir: | ||
os.environ["OUTLINES_CACHE_DIR"] = tempdir | ||
outlines.caching.get_cache.cache_clear() | ||
reload(outlines) | ||
reload(outlines.fsm.guide) | ||
cache_status = outlines.caching._caching_enabled | ||
try: | ||
outlines.caching._caching_enabled = True | ||
yield | ||
finally: | ||
outlines.caching._caching_enabled = cache_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters