-
Notifications
You must be signed in to change notification settings - Fork 844
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Calling zero_shot_classification on facebook/bart-large-mnli is giving the error -
TypeError: list indices must be integers or slices, not str
Putting a breakpoint in _client.py shows that the model does provide a valid output but the parsing is crashing -
[{'label': 'Lyckeby CB', 'score': 0.16015051305294037}, {'label': 'Two Seas Sea Salt® SS28 NFMG', 'score': 0.1264156550168991}, {'label': 'Two Seas Sea Salt® SS57 NF', 'score': 0.12420658022165298}, {'label': 'Two Seas Sea Salt® SS35 NF', 'score': 0.11956281214952469}, {'label': 'Cytoguard® YM', 'score': 0.11030302196741104}, {'label': 'Two Seas Sea Salt® SS50 MG', 'score': 0.1064852699637413}, {'label': 'Two Seas Sea Salt® SS50 NF', 'score': 0.10636811703443527}, {'label': 'Cytoguard® Stat-N', 'score': 0.04577957093715668}, {'label': 'Cytoguard® CDP UltraCytoguard® Stat-N Plus', 'score': 0.043344564735889435}, {'label': 'Lyckeby Swely Gel', 'score': 0.018959535285830498}, {'label': 'Lyckeby Careful Clean-Label Functional Potato Starch', 'score': 0.01371594239026308}, {'label': 'Rowanberry Extract', 'score': 0.01245410367846489}, {'label': 'Clean-Label Functional Corn Starch', 'score': 0.01225432101637125}]Reproduction
client = InferenceClient(
provider=provider,
api_key=os.environ["HF_INFERENCE_API_KEY"],
)
client.zero_shot_classification(
query,
candidate_labels=labels,
model='facebook/bart-large-mnli',
)Logs
File "..../python3.10/site-packages/huggingface_hub/inference/_client.py", line 3200, in zero_shot_classification
for label, score in zip(output["labels"], output["scores"])
TypeError: list indices must be integers or slices, not strSystem info
- huggingface_hub version: 1.1.4
- Platform: macOS-26.1-arm64-arm-64bit
- Python version: 3.10.18
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: /Users/ppunit/.cache/huggingface/token
- Has saved token ?: False
- Configured git credential helpers: osxkeychain
- Installation method: unknown
- httpx: 0.28.1
- hf_xet: 1.2.0
- gradio: N/A
- tensorboard: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /Users/ppunit/.cache/huggingface/hub
- HF_ASSETS_CACHE: /Users/ppunit/.cache/huggingface/assets
- HF_TOKEN_PATH: /Users/ppunit/.cache/huggingface/token
- HF_STORED_TOKENS_PATH: /Users/ppunit/.cache/huggingface/stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_DISABLE_XET: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
- HF_XET_HIGH_PERFORMANCE: Falsehanouticelina
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working