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

transformers 4.41.0 breaks generate() for T5 #30892

Closed
1 of 4 tasks
abdulfatir opened this issue May 18, 2024 · 1 comment · Fixed by #30899
Closed
1 of 4 tasks

transformers 4.41.0 breaks generate() for T5 #30892

abdulfatir opened this issue May 18, 2024 · 1 comment · Fixed by #30899
Labels
Generation Should Fix This has been identified as a bug and should be fixed.

Comments

@abdulfatir
Copy link

System Info

  • transformers version: 4.41.0
  • Platform: Linux-5.15.0-1033-aws-x86_64-with-glibc2.31
  • Python version: 3.10.9
  • Huggingface_hub version: 0.23.0
  • Safetensors version: 0.4.3
  • Accelerate version: 0.30.0
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.3.0+cu121 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Who can help?

@ArthurZucker and @younesbelkada

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

The following code breaks in v4.41.0 (it works on earlier versions).

import torch
from transformers import GenerationConfig
from transformers import T5ForConditionalGeneration

model = T5ForConditionalGeneration.from_pretrained(
    "google/t5-efficient-tiny", device_map="cuda"
)
input_ids = torch.tensor([[4, 5, 6, 6, 7]], device="cuda")
model.generate(
    input_ids=input_ids,
    generation_config=GenerationConfig(do_sample=True),
)

Error:

ValueError: `decoder_start_token_id` or `bos_token_id` has to be defined for encoder-decoder generation.

Expected behavior

Expected generate to work like before without manually specifying decoder_start_token_id or bos_token_id in the GenerationConfig.

@younesbelkada
Copy link
Contributor

Thanks @abdulfatir !
#30899 from @zucchini-nlp should fix the issue ! :)

@amyeroberts amyeroberts added Should Fix This has been identified as a bug and should be fixed. Generation labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Generation Should Fix This has been identified as a bug and should be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants