Skip to content

Provide clearer instructions on how to specify target language.#38786

Open
khof312 wants to merge 2 commits into
huggingface:mainfrom
khof312:patch-1
Open

Provide clearer instructions on how to specify target language.#38786
khof312 wants to merge 2 commits into
huggingface:mainfrom
khof312:patch-1

Conversation

@khof312

@khof312 khof312 commented Jun 12, 2025

Copy link
Copy Markdown

In the current documentation, I believe there is an error in the sample code. While the language token of the input is specified as <2pt> (Portuguese), the returned translation is in Italian, so actually the language should be <2it>.

I didn't initially understand that this was a token for the target language, so I have added an explanation of this to the documentation as well as instructions on how to get the available languages based on the code in Juarez Bochi's demo space.

It would be good to check that I have retrieved the correct range of tokens (4-459) and not omitted any (there were some additional tokens that looked to refer to scripts instead of languages, but I was not sure).

If these changes are approved, then they should also be perpetuated to the documentation of the different model checkpoints from google and jbochi.

In the current documentation, I believe there is an error in the sample code. While the language token of the input is specified as `<2pt>` (Portuguese), the returned translation is in Italian, so actually the language should be `<2it>`.

I didn't initially understand that this was a token for the target language, so I have added an explanation of this to the documentation as well as instructions on how to get the available languages based on the [code](https://huggingface.co/spaces/jbochi/madlad400-3b-mt/blob/main/app.py) in Juarez Bochi's demo space.

It would be good to check that I have retrieved the correct range of tokens (4-459) and not omitted any (there were some additional tokens that looked to refer to scripts instead of languages, but I was not sure).

If these changes are approved, then they should also be perpetuated to the documentation of the different model checkpoints from google and jbochi.
@Rocketknight1

Rocketknight1 commented Jun 12, 2025

Copy link
Copy Markdown
Member

Hi @khof312, "Eu amo pizza!" is Portuguese, not Italian. The reference to pizza is deceptive, I realize, but in Italian this would be "Amo la pizza!", or maybe "Io amo la pizza!".

Fix the mistake on misidentifying the language.
@khof312

khof312 commented Jul 18, 2025

Copy link
Copy Markdown
Author

Oops, you are right about the language, my mistake. In this case the <2pt> language code (line 56) need not be changed, but is it still worth adding documentation of how to find the respective language codes?

(I have changed the associated file accordingly to fix my error).

@Rocketknight1

Rocketknight1 commented Jul 21, 2025

Copy link
Copy Markdown
Member

cc @stevhliu for the docs question!

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I think adding docs for how to find the language code is still useful!

['Eu amo pizza!']
```

Note that in the input sentence, "`<2pt>`" is a token determining the target language of the translation. To see all supported language codes and their corresponding tokens:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would add this sentence before the code example so users know what it is beforehand

Suggested change
Note that in the input sentence, "`<2pt>`" is a token determining the target language of the translation. To see all supported language codes and their corresponding tokens:
Include the target language token in the input sentence. `<2pt>` is the token for Portuguese.

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.

3 participants