💡 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
Rename multi_class to multi_label to match Transformers ZSL change
davidmezzettid5f8ae83103d
diff --git a/src/python/txtai/pipeline/labels.py b/src/python/txtai/pipeline/labels.pyindex ef657c9e..fe0743c1 100644--- a/src/python/txtai/pipeline/labels.py+++ b/src/python/txtai/pipeline/labels.py@@ -13,7 +13,7 @@ class Labels(HFPipeline):def __init__(self, path=None, quantize=False, gpu=True, model=None):super().__init__("zero-shot-classification", path, quantize, gpu, model)- def __call__(self, text, labels, multiclass=False):+ def __call__(self, text, labels, multilabel=False):"""Applies a zero shot classifier to text using a list of labels. Returns a list of(id, score) sorted by highest score, where id is the index in labels.@@ -31,7 +31,7 @@ class Labels(HFPipeline):"""# Run ZSL pipeline- results = self.pipeline(text, labels, multi_class=multiclass)+ results = self.pipeline(text, labels, multi_label=multilabel)# Convert results to a list if necessaryif not isinstance(results, list):diff --git a/src/python/txtai/pipeline/similarity.py b/src/python/txtai/pipeline/similarity.pyindex 2784fda7..3140fead 100644--- a/src/python/txtai/pipeline/similarity.py+++ b/src/python/txtai/pipeline/similarity.py@@ -12,7 +12,7 @@ class Similarity(Labels):Computes similarity between query and list of text using a zero shot classifier."""- def __call__(self, query, texts, multiclass=True):+ def __call__(self, query, texts, multilabel=True):"""Computes the similarity between query and list of text. Returns a list of(id, score) sorted by highest score, where id is the index in texts.@@ -30,7 +30,7 @@ class Similarity(Labels):"""# Call Labels pipeline for texts using input query as the candidate label- scores = super().__call__(texts, [query] if isinstance(query, str) else query, multiclass)+ scores = super().__call__(texts, [query] if isinstance(query, str) else query, multilabel)# Sort on query index idscores = [[score for _, score in sorted(row)] for row in scores]