mirror of
https://github.com/mii443/tokenizers.git
synced 2025-12-09 14:18:30 +00:00
Avoid breaking changes and let parameter name be Optional.
Signed-off-by: Morgan Funtowicz <morgan@huggingface.co>
This commit is contained in:
@@ -23,19 +23,7 @@ impl Model {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[args(kwargs = "**")]
|
fn save(&self, folder: &str, name: Option<&str>) -> PyResult<Vec<String>> {
|
||||||
fn save(&self, folder: &str, kwargs: Option<&PyDict>) -> PyResult<Vec<String>> {
|
|
||||||
let mut name: Option<&str> = None;
|
|
||||||
if let Some(kwargs) = kwargs {
|
|
||||||
for (key, value) in kwargs {
|
|
||||||
let key: &str = key.extract()?;
|
|
||||||
match key {
|
|
||||||
"name" => name = value.extract()?,
|
|
||||||
_ => println!("Ignored unknown kwarg option {}", key),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let saved: PyResult<Vec<_>> = ToPyResult(
|
let saved: PyResult<Vec<_>> = ToPyResult(
|
||||||
self.model
|
self.model
|
||||||
.execute(|model| model.save(Path::new(folder), name)),
|
.execute(|model| model.save(Path::new(folder), name)),
|
||||||
|
|||||||
Reference in New Issue
Block a user