why max length is -21?????

#40
by George-H - opened

I am running example code on an Ubuntu 20.04 system, but I am encountering an error with max length=-21. I checked the debugging process, and max length has consistently been 20. Why is this happening?

import sys; print('Python %s on %s' % (sys.version, sys.platform))
/mnt/Ubuntu/miniconda3/envs/ptg/bin/python3.8 /mnt/Ubuntu/pycharm-2024.3.1/plugins/python-ce/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --port 29781 --file /mnt/02-WorkDir/someScript/blip2_opt.py
Loading checkpoint shards: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:13<00:00, 6.55s/it]
Traceback (most recent call last):
File "/mnt/Ubuntu/miniconda3/envs/ptg/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/mnt/Ubuntu/miniconda3/envs/ptg/lib/python3.8/site-packages/transformers/models/blip_2/modeling_blip_2.py", line 2337, in generate
outputs = self.language_model.generate(
File "/mnt/Ubuntu/miniconda3/envs/ptg/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/mnt/Ubuntu/miniconda3/envs/ptg/lib/python3.8/site-packages/transformers/generation/utils.py", line 2068, in generate
self._validate_generated_length(generation_config, input_ids_length, has_default_max_length)
File "/mnt/Ubuntu/miniconda3/envs/ptg/lib/python3.8/site-packages/transformers/generation/utils.py", line 1383, in _validate_generated_length
raise ValueError(
ValueError: Input length of input_ids is 0, but max_length is set to -21. This can lead to unexpected behavior. You should consider increasing max_length or, better yet, setting max_new_tokens.
python-BaseException

Sign up or log in to comment