mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Fixing hanging error while acquiring GIL from custom pretokenizer during training. (#470)
* Fixing hanging error while acquiring GIL from custom pretokenizer during training. Fixes #469 * cleanup Co-authored-by: Anthony MOI <m.anthony.moi@gmail.com>
This commit is contained in:
@ -751,7 +751,9 @@ impl PyTokenizer {
|
||||
}
|
||||
|
||||
fn train(&mut self, trainer: &PyTrainer, files: Vec<String>) -> PyResult<()> {
|
||||
ToPyResult(self.tokenizer.train_and_replace(trainer, files)).into()
|
||||
let gil = Python::acquire_gil();
|
||||
gil.python()
|
||||
.allow_threads(|| ToPyResult(self.tokenizer.train_and_replace(trainer, files)).into())
|
||||
}
|
||||
|
||||
#[args(pair = "None", add_special_tokens = true)]
|
||||
|
Reference in New Issue
Block a user