Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline instantiation of model "facebook/nllb-200-distilled-600M" requires source and target language as mandatory #27753

Closed
2 of 4 tasks
drunkeninja42 opened this issue Nov 28, 2023 · 8 comments

Comments

@drunkeninja42
Copy link

System Info

  • transformers version: 4.35.2
  • Platform: Linux-5.15.120+-x86_64-with-glibc2.35
  • Python version: 3.10.12
  • Huggingface_hub version: 0.19.4
  • Safetensors version: 0.4.0
  • Accelerate version: not installed
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.1.0+cu118 (False)
  • Tensorflow version (GPU?): 2.14.0 (False)
  • Flax version (CPU?/GPU?/TPU?): 0.7.5 (cpu)
  • Jax version: 0.4.20
  • JaxLib version: 0.4.20
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Who can help?

@stevhliu @MKhalusova

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

Steps to Reproduce:

  1. Go to https://huggingface.co/facebook/nllb-200-distilled-600M
  2. Click Use in Transformers Tag
  3. Copy the # Use a pipeline as a high-level helper code snippet
  4. Run in your notebook
  5. Error is displayed asking for src_lang and tgt_lang as mandatory kwags.
    code snippet

Expected behavior

I expect the code snippet in the Use in Transformers tag to mention these kwags in the example as they are mandatory to be used in this model and while the translation tasks.

I will love to contribute to this issue.
Thanks!

@stevhliu
Copy link
Member

Hi, for translation pipelines you can do translation_xx_to_yy, for example:

from transformers import pipeline

pipe = pipeline("translation_en_to_fr", model="facebook/nllb-200-distilled-600M")
pipe("Let's go to france and see the eiffel tower")

Not every translation model requires this, but I think it'd be more inclusive to add translation_xx_to_yy for models that require a src_lang and tgt_lang. WDYT @ArthurZucker?

@ArthurZucker
Copy link
Collaborator

MMmm yes and not, the snippet is automatically generated and cannot account for every use-case. You are right @stevhliu, see the doc is very much lacking 😅

@drunkeninja42
Copy link
Author

Hey @ArthurZucker @stevhliu !
If there are some improvements or work required in this issue, I would love to work and contribute to🤗

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@ArthurZucker
Copy link
Collaborator

Hey @drunkeninja42 feel free to open a PR that increase the specific doc in this case if yo feel like it!

@drunkeninja42
Copy link
Author

Sure @ArthurZucker , will raise the PR for this today, Thanks !

@st81
Copy link
Contributor

st81 commented Feb 25, 2024

@ArthurZucker
I'm eager to address this issue and I believe it might be beneficial to implement a code snippet similar to the one provided below.

# Use a pipeline as a high-level helper
from transformers import pipeline

# Change `xx` to the language of the input and `yy` to the language of the desired output.
pipe = pipeline("translation_xx_to_yy", model="facebook/nllb-200-distilled-600M")

However, I'm unsure about the exact location in the source code where I should make modifications to update the code snippet. Could you please provide guidance on this matter? Thank you!

@ArthurZucker
Copy link
Collaborator

This should go in the nllb.md IMO!

UtkarshaGupte added a commit to UtkarshaGupte/transformers that referenced this issue Apr 1, 2024
Configuring Translation Pipelines documents update
ArthurZucker pushed a commit that referenced this issue Apr 17, 2024
* Configuring Translation Pipelines documents update #27753

Configuring Translation Pipelines documents update

* Language Format Addition

* adding supported list of languages list
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this issue Apr 18, 2024
…uggingface#29986)

* Configuring Translation Pipelines documents update huggingface#27753

Configuring Translation Pipelines documents update

* Language Format Addition

* adding supported list of languages list
ArthurZucker pushed a commit that referenced this issue Apr 22, 2024
* Configuring Translation Pipelines documents update #27753

Configuring Translation Pipelines documents update

* Language Format Addition

* adding supported list of languages list
ydshieh pushed a commit that referenced this issue Apr 23, 2024
* Configuring Translation Pipelines documents update #27753

Configuring Translation Pipelines documents update

* Language Format Addition

* adding supported list of languages list
itazap pushed a commit that referenced this issue May 14, 2024
* Configuring Translation Pipelines documents update #27753

Configuring Translation Pipelines documents update

* Language Format Addition

* adding supported list of languages list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants