Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Unsloth FastVisionModel for VLM #7295

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

PLoic
Copy link

@PLoic PLoic commented Mar 13, 2025

What does this PR do?

This PR propose to use unsloth FastVisionModel instead of FastLanguageModel for multimodal model.

@@ -48,11 +53,14 @@ def load_unsloth_pretrained_model(
config: "PretrainedConfig", model_args: "ModelArguments"
) -> Optional["PreTrainedModel"]:
r"""Optionally load pretrained model with unsloth. Used in training."""
from unsloth import FastLanguageModel # type: ignore
if is_multimodal(model_args.model_name_or_path):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.



def load_unsloth_peft_model(
config: "PretrainedConfig", model_args: "ModelArguments", is_trainable: bool
) -> "PreTrainedModel":
r"""Load peft model with unsloth. Used in both training and inference."""
from unsloth import FastLanguageModel # type: ignore
if is_multimodal(model_args.model_name_or_path):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about the situation of providing a local path to the model?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks ! I will check for that ASAP

@PLoic PLoic marked this pull request as draft March 14, 2025 21:27
@PLoic PLoic marked this pull request as ready for review March 15, 2025 20:03
@PLoic PLoic requested a review from hiyouga March 17, 2025 08:22
@PLoic PLoic marked this pull request as draft March 18, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants