fix: vision image token insertion#671
Conversation
…lity Signed-off-by: yashasvi <yashasvi@ibm.com>
|
Thanks for making a pull request! 😃 |
Signed-off-by: yashasvi <yashasvi@ibm.com>
1c7bd0d to
b2344fd
Compare
|
/build |
|
|
||
| @pytest.mark.skipif( | ||
| torch.backends.mps.is_available() and not torch.cuda.is_available(), | ||
| reason="MoE models have histogram incompatibility with MPS backend", |
There was a problem hiding this comment.
why are we adding this here? this test was running fine without anything right? is it not running on mac now?
if so what model are we using which is MoE? can we choose another?
There was a problem hiding this comment.
ahh I did miss this, this was for my local testing tho.. the test was failing on my mac locally..
Shouldn't be a problem for github actions test coverage btw
|
Build succeeded for |
|
/build |
|
Build failed for |
|
/build |
|
Build succeeded for |
|
Build succeeded for |
Signed-off-by: yashasvi <yashasvi@ibm.com>
Signed-off-by: yashasvi <yashasvi@ibm.com>
400238c to
45772b3
Compare
Signed-off-by: Yashasvi Chaurasia <46622381+YashasviChaurasia@users.noreply.github.com>
dushyantbehl
left a comment
There was a problem hiding this comment.
LGTM. @YashasviChaurasia please fix the resolve conflicts and we can merge this PR.
Signed-off-by: Yashasvi Chaurasia <46622381+YashasviChaurasia@users.noreply.github.com>
|
/build |
|
Build failed for |
Signed-off-by: yashasvi <yashasvi@ibm.com>
|
/build |
|
Build failed for |
|
Build failed for |
|
/build |
|
Build failed for |
Description of the change
This PR includes two critical fixes:
Problem 1: Vision Model Training Failure
Error:
Root Cause:
The
apply_tokenizer_chat_templatehandler wasn't correctly extracting conversation messages from OpenAI format datasets whenconversation_column_namewas not explicitly set. This resulted in formatted text without<image>tokens, causing vision model training to fail.Fix
Problem 2: Transformers v5 API Breaking Change
Error:
Root Cause:
In transformers v4.55+,
apply_chat_template()withreturn_tensors='pt'changed behavior:{"input_ids": tensor}(dict)tensordirectly ORBatchEncodingobject (in tox environment)The code was doing
result["input_ids"]which fails when:resultis a tensor (causes IndexError)resultis a BatchEncoding without.clone()method (causes AttributeError)Solution:
Added robust handling for all three return types in
tokenize_and_apply_chat_template_with_masking:Problem 3: Test Suite Failures
3a. test_empty_data
Error:
Root Cause:
Datasets library in transformers v5 raises StopIteration when processing empty JSON files.
Solution:
Added StopIteration to expected exceptions in the test.
3b. test_run_chat_style_ft_using_custom_split_name
Error:
Root Cause:
MoE models use histogram operations that are incompatible with Apple Silicon MPS backend.
Solution:
Skip test on MPS-only systems using @pytest.mark.skipif.
Related issue number
How to verify the PR
Was the PR tested