I’m doing a HF tutorial on transformers at Transformers, what can they do? · Hugging Face. It uses a Colab notebook at Google Colab . When I try to run the code for a summarizer, which begins with this:
from transformers import pipeline
summarizer = pipeline("summarization")
I get an error
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/tmp/ipykernel_13970/3730791013.py in <cell line: 0>()
1 from transformers import pipeline
2
----> 3 summarizer = pipeline("summarization")
4 summarizer(
5 """
2 frames/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 summarization, 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']"
The pipeline no longer supports “summarization”. Is there a way to get this to work. I’m mainly curious. It appears the pipeline module may have been updated but the Colab notebook was not.
Thanks!