Skip to content

Keep script information on FLORES-200 language tags - #1546

Open
Aarush2099 wants to merge 1 commit into
huggingface:mainfrom
Aarush2099:fix-745
Open

Aarush2099 wants to merge 1 commit into
huggingface:mainfrom
Aarush2099:fix-745

Conversation

@Aarush2099

Copy link
Copy Markdown

Fixes #745

Language is one ISO-639-3 code per language, so FLORES-200 tags like zho_Hans and zho_Hant both became Language.CHINESE. The translation template then used the same ZH label for both, and a few script variants had to be dropped from the FLORES-200 task list.

This adds a LanguageTag helper that can carry an ISO 15924 script without changing Language.value. Translation prompts include the script in the label when one is present (ZH_HANT), and the previously dropped FLORES-200 subsets are restored. Script-specific translation literals can be added later via TRANSLATION_LITERALS_BY_SCRIPT; they currently fall back to the base language.

The FLORES-200 task version is bumped to 1, because every lang_Script prompt label changes (for example EN: becomes EN_LATN:).

I left a short note on the issue outlining this approach: #745 (comment)

There was an earlier attempt in #1272, which the author closed after it went unreviewed. This is a new implementation.

I ran pytest tests/unit/utils/test_language.py tests/unit/tasks/templates/test_translation.py (10 passed) and ruff on the touched files. I did not run the full dev suite locally (pip install -e ".[dev]" pulls torch, transformers, datasets, and inspect-ai).

The Language enum is one ISO-639-3 code per language, so FLORES-200
tags such as zho_Hans and zho_Hant both collapsed to CHINESE. The
translation template then used the same ZH label for both, and several
script variants had to be dropped from the task list.

Add a LanguageTag helper that carries an optional ISO 15924 script
without changing Language.value. Translation prompts include the script
in the label when one is present, and the previously dropped FLORES-200
subsets are restored. Script-specific translation literals can be added
later; they currently fall back to the base language.

Fixes huggingface#745
Copilot AI balanced review requested due to automatic review settings November 29, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FT] Manage script and language in the Language enum

2 participants