💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
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.pyindex 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 directorystate_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 modelgpath = os.path.join(output, "generator")