Skip to content

Commit 68168c4

Browse files
authored
chore: Bump transformers (#9740)
* Bump transformers * Fix typing issue * Pin transformers to less than 5
1 parent 0fe2f8e commit 68168c4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

haystack/components/routers/transformers_text_router.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ def warm_up(self):
133133
self.pipeline = pipeline(**self.huggingface_pipeline_kwargs)
134134

135135
# Verify labels from the model configuration file match provided labels
136-
labels = set(self.pipeline.model.config.label2id.keys())
137-
if set(self.labels) != labels:
138-
raise ValueError(
139-
f"The provided labels do not match the labels in the model configuration file. "
140-
f"Provided labels: {self.labels}. Model labels: {labels}"
141-
)
136+
label2id = self.pipeline.model.config.label2id
137+
if label2id is not None:
138+
labels = set(label2id.keys())
139+
if set(self.labels) != labels:
140+
raise ValueError(
141+
f"The provided labels do not match the labels in the model configuration file. "
142+
f"Provided labels: {self.labels}. Model labels: {labels}"
143+
)
142144

143145
def to_dict(self) -> dict[str, Any]:
144146
"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ dependencies = [
9090
"pandas", # AzureOCRDocumentConverter, CSVDocumentCleaner, CSVDocumentSplitter,
9191
# EvaluationRunResult, XLSXToDocument, and pipeline tests
9292

93-
"transformers[torch, sentencepiece]>=4.52.4,<4.53", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators...
93+
"transformers[torch, sentencepiece]>=4.55.4,<5.0", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators...
9494
"huggingface_hub>=0.27.0", # Hugging Face API Generators and Embedders
9595
"sentence-transformers>=4.1.0", # Sentence Transformers Embedders, Rankers, and SASEvaluator
9696
"langdetect", # TextLanguageRouter and DocumentLanguageClassifier

0 commit comments

Comments
 (0)