-
Notifications
You must be signed in to change notification settings - Fork 668
Add optional support for Unsloth #1657
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
base: main
Are you sure you want to change the base?
Add optional support for Unsloth #1657
Conversation
f4832e3 to
acf918d
Compare
acf918d to
7788ed7
Compare
7788ed7 to
a34a3ea
Compare
|
|
||
| from oumi.utils import logging | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this import here?
| peft_params=config.peft if use_peft else None, | ||
| **(additional_model_kwargs or {}), | ||
| ) | ||
| if is_unsloth_model(config.model.model_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given build_model already handles unsloth models, do we need this check here?
| "UP035", # UP035 `typing.List` is deprecated, use `list` instead | ||
| "UP006", # UP006 Use `list` instead of `List` for type annotation | ||
| ] | ||
| "src/oumi/__init__.py" = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required?
| tokenizer: The tokenizer object built from the configuration. | ||
| """ | ||
| # Unsloth | ||
| if is_unsloth_model(model_params.model_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use the regular tokenizer?
|
@georgedouzas thank you for the contribution! At a high level, the approach looks great. If possible, it would be great to:
|
Description
This PR adds minimal support for the unsloth library without making it a required dependency of Oumi. The idea is to let users load models and tokenizers through Unsloth’s API if it’s available, without changing the trainer abstraction or adding a new TrainerType. Since Unsloth patches
transformersandtrlunder the hood, it can work with the existing setup without needing a brand-new trainer.Feedback on whether this approach makes sense would be appreciated, or let me know if you would prefer a more explicit integration — like introducing a dedicated trainer type for Unsloth even though it’s patching everything internally. There are also some dependency conflicts between Unsloth and Oumi at the moment.
Related issues
#1322
Before submitting
Reviewers
At least one review from a member of
oumi-ai/oumi-staffis required.