-
Notifications
You must be signed in to change notification settings - Fork 20
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
002b771
commit de00a4d
Showing
34 changed files
with
680 additions
and
494 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,22 @@ | ||
[package] | ||
name = "rust_fsm" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "rust_fsm" | ||
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' | ||
|
||
[features] | ||
default = [] | ||
e2e_experimental = [] |
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,7 @@ | ||
from transformers import AutoTokenizer | ||
|
||
from outlines_core.fsm.guide import RegexGuide | ||
from outlines_core.models.transformers import TransformerTokenizer | ||
from transformers import AutoTokenizer | ||
|
||
|
||
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.