Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Fix issue with latest version of Transformers and TokenDetection.save_pretrained, closes #458

davidmezzettiddf610ba2ccd
diff --git a/src/python/txtai/models/tokendetection.py b/src/python/txtai/models/tokendetection.py
index e24a524a..49cfbea0 100644
--- a/src/python/txtai/models/tokendetection.py
+++ b/src/python/txtai/models/tokendetection.py
@@ -98,17 +98,18 @@ class TokenDetection(PreTrainedModel):
loss = goutputs[0] + self.weight * doutputs[0]
return loss, goutputs[1], doutputs[1], dlabels
- def save_pretrained(self, output, state_dict=None):
+ def save_pretrained(self, output, state_dict=None, **kwargs):
"""
Saves current model to output directory.
Args:
output: output directory
state_dict: model state
+ kwargs: additional keyword arguments
"""
# Save combined model to support training from checkpoints
- super().save_pretrained(output, state_dict)
+ super().save_pretrained(output, state_dict, **kwargs)
# Save generator tokenizer and model
gpath = os.path.join(output, "generator")