Skip to content

pipeline() lists translation tasks but translation pipeline is missing (KeyError) #43825

@math-hiyoko

Description

@math-hiyoko

System Info

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

  • transformers version: 5.2.0.dev0
  • Platform: Linux-6.6.105+-x86_64-with-glibc2.35
  • Python version: 3.12.12
  • Huggingface_hub version: 1.3.7
  • Safetensors version: 0.7.0
  • Accelerate version: 1.12.0
  • Accelerate config: not found
  • DeepSpeed version: not installed
  • PyTorch version (accelerator?): 2.9.0+cpu (NA)
  • Using distributed or parallel set-up in script?: parallel

Who can help?

@Rocketknight1

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

When calling transformers.pipeline() with an unknown task, the error message lists translation_XX_to_YY as an available task. However, in Transformers v5, the default pipeline() does not provide the "translation" pipeline in supported_tasks, so attempting to use translation_XX_to_YY leads to a KeyError: 'translation'.

Also, calling pipeline("translation") raises:
KeyError: "Invalid translation task translation, use 'translation_XX_to_YY' format"
but since "translation" is not actually supported, the expected error should be closer to:
KeyError: "Unknown task translation, available tasks are ..."

Colab link: https://colab.research.google.com/drive/1aKTGHuuDhpdxAJlJB8txOmcyAKeNoz2i?usp=sharing

Expected behavior

KeyError: "Unknown task hoge, 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']

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions