mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
pyo3: update to 0.20 (#1386)
Co-authored-by: Mike Lui <mikelui@meta.com>
This commit is contained in:
@ -14,8 +14,8 @@ serde = { version = "1.0", features = [ "rc", "derive" ]}
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
pyo3 = { version = "0.19" }
|
pyo3 = { version = "0.20" }
|
||||||
numpy = "0.19.0"
|
numpy = "0.20.0"
|
||||||
ndarray = "0.15"
|
ndarray = "0.15"
|
||||||
onig = { version = "6.4", default-features = false }
|
onig = { version = "6.4", default-features = false }
|
||||||
itertools = "0.11"
|
itertools = "0.11"
|
||||||
@ -26,7 +26,7 @@ path = "../../tokenizers"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.8"
|
tempfile = "3.8"
|
||||||
pyo3 = { version = "0.19", features = ["auto-initialize"] }
|
pyo3 = { version = "0.20", features = ["auto-initialize"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
defaut = ["pyo3/extension-module"]
|
defaut = ["pyo3/extension-module"]
|
||||||
|
@ -266,15 +266,15 @@ impl FromPyObject<'_> for PySpecialToken {
|
|||||||
Ok(Self(v.into()))
|
Ok(Self(v.into()))
|
||||||
} else if let Ok(d) = ob.downcast::<PyDict>() {
|
} else if let Ok(d) = ob.downcast::<PyDict>() {
|
||||||
let id = d
|
let id = d
|
||||||
.get_item("id")
|
.get_item("id")?
|
||||||
.ok_or_else(|| exceptions::PyValueError::new_err("`id` must be specified"))?
|
.ok_or_else(|| exceptions::PyValueError::new_err("`id` must be specified"))?
|
||||||
.extract::<String>()?;
|
.extract::<String>()?;
|
||||||
let ids = d
|
let ids = d
|
||||||
.get_item("ids")
|
.get_item("ids")?
|
||||||
.ok_or_else(|| exceptions::PyValueError::new_err("`ids` must be specified"))?
|
.ok_or_else(|| exceptions::PyValueError::new_err("`ids` must be specified"))?
|
||||||
.extract::<Vec<u32>>()?;
|
.extract::<Vec<u32>>()?;
|
||||||
let tokens = d
|
let tokens = d
|
||||||
.get_item("tokens")
|
.get_item("tokens")?
|
||||||
.ok_or_else(|| exceptions::PyValueError::new_err("`tokens` must be specified"))?
|
.ok_or_else(|| exceptions::PyValueError::new_err("`tokens` must be specified"))?
|
||||||
.extract::<Vec<String>>()?;
|
.extract::<Vec<String>>()?;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ use pyo3::exceptions;
|
|||||||
use pyo3::intern;
|
use pyo3::intern;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::types::*;
|
use pyo3::types::*;
|
||||||
use pyo3::AsPyPointer;
|
|
||||||
use tk::models::bpe::BPE;
|
use tk::models::bpe::BPE;
|
||||||
use tk::tokenizer::{
|
use tk::tokenizer::{
|
||||||
Model, PaddingDirection, PaddingParams, PaddingStrategy, PostProcessor, TokenizerImpl,
|
Model, PaddingDirection, PaddingParams, PaddingStrategy, PostProcessor, TokenizerImpl,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::AsPyPointer;
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
/// An simple iterator that can be instantiated with a specified length.
|
/// An simple iterator that can be instantiated with a specified length.
|
||||||
|
Reference in New Issue
Block a user