mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-22 16:25:30 +00:00
Python - BPE construction
This commit is contained in:
@ -30,11 +30,8 @@ pub struct BPE {}
|
|||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl BPE {
|
impl BPE {
|
||||||
#[staticmethod]
|
#[staticmethod]
|
||||||
fn from_files() -> PyResult<Model> {
|
fn from_files(vocab: &str, merges: &str) -> PyResult<Model> {
|
||||||
match tk::models::bpe::BPE::from_files(
|
match tk::models::bpe::BPE::from_files(vocab, merges) {
|
||||||
"../../data/gpt2-vocab.json",
|
|
||||||
"../../data/gpt2-merges.txt",
|
|
||||||
) {
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error: {:?}", e);
|
println!("Error: {:?}", e);
|
||||||
Err(exceptions::Exception::py_err(
|
Err(exceptions::Exception::py_err(
|
||||||
|
Reference in New Issue
Block a user