fix: vision image token insertion#671
Open
YashasviChaurasia wants to merge 2 commits intofoundation-model-stack:mainfrom
Open
fix: vision image token insertion#671YashasviChaurasia wants to merge 2 commits intofoundation-model-stack:mainfrom
YashasviChaurasia wants to merge 2 commits intofoundation-model-stack:mainfrom
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
Collaborator
|
/build |
|
|
||
| @pytest.mark.skipif( | ||
| torch.backends.mps.is_available() and not torch.cuda.is_available(), | ||
| reason="MoE models have histogram incompatibility with MPS backend", |
Collaborator
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?
Contributor
Author
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 |
Collaborator
|
/build |
|
Build failed for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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