💡 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
Revert labels list workaround in #118, fixed in transformers 4.11.3
davidmezzetti5f4c5fa637f9
diff --git a/setup.py b/setup.pyindex cd5e9652..96a50151 100644--- a/setup.py+++ b/setup.py@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:DESCRIPTION = f.read()# Required dependencies-install = ["faiss-cpu>=1.7.1.post2", "numpy>=1.18.4", "torch>=1.6.0", "transformers>=4.11.2"]+install = ["faiss-cpu>=1.7.1.post2", "numpy>=1.18.4", "torch>=1.6.0", "transformers>=4.11.3"]# Optional dependenciesextras = {}diff --git a/src/python/txtai/pipeline/labels.py b/src/python/txtai/pipeline/labels.pyindex 04e84f8d..ec3869df 100644--- a/src/python/txtai/pipeline/labels.py+++ b/src/python/txtai/pipeline/labels.py@@ -39,13 +39,6 @@ class Labels(HFPipeline):if self.dynamic:# Run zero shot classification pipelineresults = self.pipeline(text, labels, multi_label=multilabel, truncation=True, num_workers=workers)-- # Convert results to a list if necessary- if not isinstance(results, list):- results = [results]-- # Unpack nested lists if necessary- results = [result[0] if isinstance(result, list) else result for result in results]else:# Set classification function based on inputsfunction = "sigmoid" if multilabel or len(self.labels()) == 1 else "softmax"@@ -53,6 +46,10 @@ class Labels(HFPipeline):# Run text classification pipelineresults = self.pipeline(text, return_all_scores=True, function_to_apply=function, num_workers=workers)+ # Convert results to a list if necessary+ if not isinstance(results, list):+ results = [results]+# Build list of (id, score)scores = []for result in results: