Fix IndexError in HunyuanVideo I2V pipeline#13244
Fix IndexError in HunyuanVideo I2V pipeline#13244yiyixuxu merged 13 commits intohuggingface:mainfrom
Conversation
latest transformers Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
|
Problem Cause Fix |
|
Here is the sample code to reproduce: |
|
@DN6 , Hi, can you help review? Thx |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
@DN6 Hi, Can we merge this PR? |
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks for the PR!
i left one comment
|
|
||
| # Fallback for newer transformers versions where double newline is not tokenized as a separate token | ||
| # In this case, use the last <|end_header_id|> token position + 1 as the assistant section marker | ||
| if last_double_return_token_indices.numel() == 0: |
There was a problem hiding this comment.
should we just replace the hard coded numbers with this logic instead? regardless the transformer version?
There was a problem hiding this comment.
Thx for the advice. Have updated the code.
…ction marker Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks!
Do you know which version of Transformeer introduced this behavior?
Would you be able to run a test with an older transnfomer version to make sure we don't break backward?
| :, -1 | ||
| ] | ||
| # Get the last <|end_header_id|> position per batch, then +1 to get the position after it | ||
| last_double_return_token_indices = end_header_indices.reshape(text_input_ids.shape[0], -1)[:, -1] + 1 |
There was a problem hiding this comment.
should we change the name of this variable now?
There was a problem hiding this comment.
Oh, yes. Thx for the advice~ Done for it.
|
It should be an incompatible bug from transformers 5.0.0.
And when I use this fix with both transformers 4.57.6 and 5.0.0, it works well. |
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
|
thanks so much for working on this! @kaixuanliu |
@yiyixuxu @asomoza, pls help review, thx!