{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiaougp3k3n54u4klhkrxvjrlg2grnsv3pxoscayamjynab7voqo4i",
    "uri": "at://did:plc:pgryn3ephfd2xgft23qokfzt/app.bsky.feed.post/3mg7pe6daoyk2"
  },
  "path": "/t/llm-course-code-errors/173989#post_1",
  "publishedAt": "2026-03-04T05:47:06.000Z",
  "site": "https://discuss.huggingface.co",
  "textContent": "I’m following the LLM Course. I’m trying the tutorial code snippets in Google colab. I get the following errors in machine translation, text summarization and named entity recognition. Any help to resolve them will be much appreciated.\n\n* * *\n\n* * *\n\nMachine Translation\n\n\n    ---------------------------------------------------------------------------\n    KeyError                                  Traceback (most recent call last)\n    /tmp/ipykernel_365/531379416.py in <cell line: 0>()\n          1 from transformers import pipeline\n          2\n    ----> 3 translator = pipeline(\"translation\", model=\"Helsinki-NLP/opus-mt-fr-en\")\n          4\n          5 translator(\"Ce cours est produit par Hugging Face.\")\n\n\n    /usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py in check_task(self, task)\n       1352                 task = \"translation\"\n       1353                 return task, targeted_task, (tokens[1], tokens[3])\n    -> 1354             raise KeyError(f\"Invalid translation task {task}, use 'translation_XX_to_YY' format\")\n       1355\n       1356         raise KeyError(\n\n    KeyError: \"Invalid translation task translation, use 'translation_XX_to_YY' format\"\n\n\nText Summarization\n\n\n    KeyError                                  Traceback (most recent call last)\n\n\n\n\n    /tmp/ipykernel_365/3730791013.py in <cell line: 0>()\n          1 from transformers import pipeline\n          2\n    ----> 3 summarizer = pipeline(\"summarization\")\n          4 summarizer(\n          5     \"\"\"\n\n    2 frames\n\n\n* * *\n\n\n    /usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py in check_task(self, task)\n       1354             raise KeyError(f\"Invalid translation task {task}, use 'translation_XX_to_YY' format\")\n       1355\n    -> 1356         raise KeyError(\n       1357             f\"Unknown task {task}, available tasks are {self.get_supported_tasks() + ['translation_XX_to_YY']}\"\n       1358         )\n\n    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']\"\n\n\nNamed Entity Recognition\n\n\n    TypeError                                 Traceback (most recent call last)\n\n\n\n\n    /tmp/ipykernel_365/3280479951.py in <cell line: 0>()\n          1 from transformers import pipeline\n          2\n    ----> 3 ner = pipeline(\"ner\", grouped_entities=True)\n          4\n          5 ner(\"My name is Sylvain and I work at Hugging Face in Brooklyn.\")\n\n    2 frames\n\n\n/usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py in __init_ _(self, model, tokenizer, feature_extractor, image_processor, processor, task, device, binary_output, **kwargs)\n919 self._batch_size = kwargs.pop(“batch_size”, None)\n920 self._num_workers = kwargs.pop(“num_workers”, None)\n→ 921 self._preprocess_params, self._forward_params, self._postprocess_params = self._sanitize_parameters(**kwargs)\n922\n923 # In processor only mode, we can get the modality processors from the processor\n\nTypeError: TokenClassificationPipeline._sanitize_parameters() got an unexpected keyword argument ‘grouped_entities’",
  "title": "LLM Course code errors"
}