Closed
Description
System Info
Hello,
I am trying to feed a customized position IDs to Llama model.
If I fed a customized position_ids vector, for example, [[0, 0, 1, 2, 2, 2]] means batch size = 1, 1st and 2nd tokens share the same position, and 3rd-5th tokens share the same position 2, this will cause an error.
The error seems to be located in the function prepare_inputs_for_generation
in src/transformers/models/llama/modeling_llama.py
, where the position_ids
does not change as the cache_position
increase, so the shape inconsistency occurs.
Is there any way to successfully feed a customized position ids to the model?
Thanks!
Who can help?
No response
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
- Give a customized
position_ids
as one of the input inmodel.generate()
Expected behavior
Size mismatch