Example not working
#2
by IDKWhy17 - opened
I got an exception when running the first example
Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/tmp/ipykernel_55/3123635916.py in <cell line: 0>()
3
4 model_name = 'pierreguillou/byt5-small-qa-squad-v1.1-portuguese'
----> 5 nlp = pipeline("text2text-generation", model=model_name)
6
7 # source: https://pt.wikipedia.org/wiki/Pandemia_de_COVID-19
/usr/local/lib/python3.12/dist-packages/transformers/pipelines/__init__.py in pipeline(task, model, config, tokenizer, feature_extractor, image_processor, processor, revision, use_fast, token, device, device_map, dtype, trust_remote_code, model_kwargs, pipeline_class, **kwargs)
775 )
776 else:
--> 777 normalized_task, targeted_task, task_options = check_task(task)
778 if pipeline_class is None:
779 pipeline_class = targeted_task["impl"]
/usr/local/lib/python3.12/dist-packages/transformers/pipelines/__init__.py in check_task(task)
379
380 """
--> 381 return PIPELINE_REGISTRY.check_task(task)
382
383
/usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py in check_task(self, task)
1354 raise KeyError(f"Invalid translation task {task}, use 'translation_XX_to_YY' format")
1355
-> 1356 raise KeyError(
1357 f"Unknown task {task}, available tasks are {self.get_supported_tasks() + ['translation_XX_to_YY']}"
1358 )
KeyError: "Unknown task text2text-generation, available tasks are ['any-to-any', 'audio-classification', 'automatic-speech-recognition', 'depth-estimation', 'document-question-answering', 'feature-extraction', 'fill-mask', 'image-classification', 'image-feature-extraction', 'image-segmentation', 'image-text-to-text', 'image-to-image', 'keypoint-matching', 'mask-generation', 'ner', 'object-detection', 'question-answering', 'sentiment-analysis', 'table-question-answering', 'text-classification', 'text-generation', 'text-to-audio', 'text-to-speech', 'token-classification', 'video-classification', 'visual-question-answering', 'vqa', 'zero-shot-audio-classification', 'zero-shot-classification', 'zero-shot-image-classification', 'zero-shot-object-detection', 'translation_XX_to_YY']"