-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace basic Numba FSM functions with Rust implementations
- Loading branch information
1 parent
956f997
commit a53b6eb
Showing
27 changed files
with
664 additions
and
478 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,7 @@ docs/build | |
.idea/ | ||
*.gguf | ||
.venv | ||
build/ | ||
benchmarks/results | ||
target/ | ||
*.so |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
[package] | ||
name = "outlines-core-rs" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "outlines_core_rs" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.22.0", features = ["extension-module"] } | ||
|
||
[profile.release] | ||
opt-level = 3 | ||
lto = true | ||
codegen-units = 1 | ||
strip = true | ||
panic = 'abort' |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,8 @@ | ||
from transformers import AutoTokenizer | ||
|
||
from outlines_core.fsm.guide import RegexGuide | ||
from outlines_core.models.transformers import TransformerTokenizer | ||
|
||
|
||
def setup_tokenizer(): | ||
tokenizer = AutoTokenizer.from_pretrained("gpt2") | ||
return TransformerTokenizer(tokenizer) | ||
|
||
|
||
def ensure_numba_compiled(tokenizer): | ||
RegexGuide("a", tokenizer) | ||
return True |
Oops, something went wrong.