ValueError: The following `model_kwargs` are not used by the model: ['length']
See original GitHub issueSystem Info
4.22.2
Who can help?
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
prompt = tokenizer(user_input, return_tensors='pt', return_length=True)
prompt = {key: value.to(device) for key, value in prompt.items()}
out = gpt.generate(**prompt, ...)
When using “return_length=True” with the tokenizer, the error is given. This is from a change in a recent version and did not happen in older versions.
ValueError: The following
model_kwargs are not used by the model: ['length'] (note: typos in the generate arguments will also show up in this list)
Expected behavior
Model should not produce an error when “return_length” is set to True Downgrade to 4.21.0 fixes the problem and according to my googling this is what people are doing
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:11 (5 by maintainers)
Top Results From Across the Web
ValueError: The following `model_kwargs` are not used by the ...
When I try to run my code for Donut for DocVQA model, I got the following error "" ...
Read more >Source code for transformers.generation_utils - Hugging Face
LongTensor: is_pad_token_in_inputs_ids = (pad_token_id is not None) and ... maximul length if unfinished_sequences.max() == 0: break # update model kwargs ...
Read more >Source code for statsmodels.tsa.statespace.dynamic_factor_mq
This does not include any lags, but it can be used with e.g. ... 0)): raise ValueError('The model must contain at least one...
Read more >Source code for statsmodels.base.model
DataFrame` args : extra arguments These are passed to the model kwargs ... from `scipy.optimize` is used, and it can be chosen from...
Read more >Source code for lenstronomy.ImSim.image2source_mapping
_deflection_scaling_list is not None: raise ValueError('deflection scaling for ... lens model kwargs list :param index_source: int, index of source model ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zzxslp
Change these line at https://github.com/salesforce/BLIP/blob/main/models/med.py#L932 as following:
from
to
Why: https://github.com/huggingface/transformers/blob/v4.23.1/src/transformers/generation_utils.py#L899
Well, in that case I just downloaded the model. You can usually initialize a random tiny model using a different configuration. Could you tell me why you need to set
return_length=True
. This has the effect of addinglength
to the list of inputs, and is not useful when generating. This argument is mostly used when training a fast tokenizer.