Repository navigation
Keep script information on FLORES-200 language tags - #1546
Open
Aarush2099 wants to merge 1 commit into
Open
Aarush2099 wants to merge 1 commit into
Aarush2099 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #745
Languageis one ISO-639-3 code per language, so FLORES-200 tags likezho_Hansandzho_Hantboth becameLanguage.CHINESE. The translation template then used the sameZHlabel for both, and a few script variants had to be dropped from the FLORES-200 task list.This adds a
LanguageTaghelper that can carry an ISO 15924 script without changingLanguage.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 viaTRANSLATION_LITERALS_BY_SCRIPT; they currently fall back to the base language.The FLORES-200 task version is bumped to 1, because every
lang_Scriptprompt label changes (for exampleEN:becomesEN_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).