Python - Test and fix classes pickling

This commit is contained in:
Anthony MOI
2020-05-18 19:52:10 -04:00
parent 6a70162d78
commit c5bba91bf4
11 changed files with 76 additions and 24 deletions

View File

@ -46,7 +46,7 @@ impl PostProcessor {
}
}
#[pyclass(extends=PostProcessor)]
#[pyclass(extends=PostProcessor, module = "tokenizers.processors")]
pub struct BertProcessing {}
#[pymethods]
impl BertProcessing {
@ -61,9 +61,13 @@ impl BertProcessing {
},
))
}
fn __getnewargs__<'p>(&self, py: Python<'p>) -> PyResult<&'p PyTuple> {
Ok(PyTuple::new(py, &[("", 0), ("", 0)]))
}
}
#[pyclass(extends=PostProcessor)]
#[pyclass(extends=PostProcessor, module = "tokenizers.processors")]
pub struct RobertaProcessing {}
#[pymethods]
impl RobertaProcessing {
@ -86,9 +90,13 @@ impl RobertaProcessing {
},
))
}
fn __getnewargs__<'p>(&self, py: Python<'p>) -> PyResult<&'p PyTuple> {
Ok(PyTuple::new(py, &[("", 0), ("", 0)]))
}
}
#[pyclass(extends=PostProcessor)]
#[pyclass(extends=PostProcessor, module = "tokenizers.processors")]
pub struct ByteLevel {}
#[pymethods]
impl ByteLevel {