Example: Making fine-tuning LFM2.5-VL-1.6B work for datasets with system prompt and vision layer fine-tuning.#448
Example: Making fine-tuning LFM2.5-VL-1.6B work for datasets with system prompt and vision layer fine-tuning.#448urbanspr1nter wants to merge 2 commits intounslothai:mainfrom
Conversation
…t and vision layer fine-tuning.
Summary of ChangesHello @urbanspr1nter, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves critical compatibility issues encountered when attempting to fine-tune the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for fine-tuning the LFM2.5-VL-1.6B model by enabling vision layer fine-tuning for Siglip2VisionConfig and handling string-based system prompts for Lfm2VlProcessor. The changes are generally in the right direction. However, I've identified a critical logic bug in unsloth_zoo/vision_utils.py where a new if statement should be an elif. This could cause incorrect data processing. My review includes a suggestion to fix this issue.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10f9775a4a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Hey @urbanspr1nter does this only impact LFM? What is the root cause of the said behaviour? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbcd787afd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
|
|
||
| import requests | ||
| from transformers import Lfm2VlProcessor |
There was a problem hiding this comment.
Guard the LFM2 processor import
This hard import makes unsloth_zoo.vision_utils fail to import in environments where transformers does not export Lfm2VlProcessor (which is plausible given the repo’s wide supported transformers range), and that breaks all vision collation paths, not just LFM2 fine-tuning. A missing symbol here raises ImportError at module import time, so users cannot even run unaffected models unless this is wrapped in a compatibility guard (for example try/except with a fallback type check by class name).
Useful? React with 👍 / 👎.
@Datta0 - I think this is most notable thing is the Siglip2VisionConfig addition. I have only tested this with LFM, but I would now assume model which system prompt isn't expected to be normalized in the way unsloth will do would be affected too. |
See: unslothai/unsloth#3938
Currently,
unslothseems to be breaking when trying to fine tuneLiquidAI/LFM2.5-VL-1.6B.Reasons: