Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
952 commits
Select commit Hold shift + click to select a range
b1ec22d
bug fix #2008 (#2039)
void-mckenzie Mar 16, 2025
ce4558b
fix (#2051)
KareemMusleh Mar 16, 2025
97c2a88
Update loader.py
danielhanchen Mar 17, 2025
64c2918
Update pyproject.toml
danielhanchen Mar 17, 2025
60b3da5
Update pyproject.toml
danielhanchen Mar 17, 2025
19c6928
Update vision.py
danielhanchen Mar 17, 2025
f358b79
more prints
danielhanchen Mar 17, 2025
301f7fd
Update loader.py
danielhanchen Mar 17, 2025
df554bc
LoRA 16bit fix
danielhanchen Mar 17, 2025
82debd2
Update vision.py
danielhanchen Mar 17, 2025
682de74
Update vision.py
danielhanchen Mar 17, 2025
28b4128
Update _utils.py
danielhanchen Mar 17, 2025
6d596da
Update vision.py
danielhanchen Mar 17, 2025
9a356a7
move forced float32
danielhanchen Mar 17, 2025
9f55885
Update _utils.py
danielhanchen Mar 17, 2025
12de176
Update _utils.py
danielhanchen Mar 17, 2025
5ca4f5c
Update _utils.py
danielhanchen Mar 17, 2025
3cf8d07
Update _utils.py
danielhanchen Mar 17, 2025
78e85e3
move print
danielhanchen Mar 17, 2025
07ea763
Update _utils.py
danielhanchen Mar 17, 2025
0cf990f
disable bfloat16
danielhanchen Mar 18, 2025
d3eaf9e
Fix forced float32
danielhanchen Mar 18, 2025
984273a
move float32
danielhanchen Mar 18, 2025
457fc12
Ensure trust_remote_code propegates down to unsloth_compile_transform…
CuppaXanax Mar 18, 2025
997fa41
Update _utils.py
danielhanchen Mar 18, 2025
e2dc4b3
Merge branch 'nightly' of https://github.com/unslothai/unsloth into n…
danielhanchen Mar 18, 2025
420380d
Show both `peft_error` and `autoconfig_error`, not just `autoconfig_e…
IsaacBreen Mar 18, 2025
0e54be4
fix error message (#2046)
KareemMusleh Mar 18, 2025
4756979
Update vision.py
danielhanchen Mar 18, 2025
50c98b5
Update _utils.py
danielhanchen Mar 18, 2025
23bac1d
Update pyproject.toml
danielhanchen Mar 18, 2025
aed7d20
Update __init__.py
danielhanchen Mar 18, 2025
7fcda1a
Update __init__.py
danielhanchen Mar 18, 2025
f0de417
Update vision.py
danielhanchen Mar 18, 2025
2e377bc
Update vision.py
danielhanchen Mar 18, 2025
5d64bff
Update vision.py
danielhanchen Mar 18, 2025
c965c86
Update vision.py
danielhanchen Mar 18, 2025
d9e984e
Update vision.py
danielhanchen Mar 18, 2025
eb959ca
Update vision.py
danielhanchen Mar 18, 2025
0372df7
Update vision.py
danielhanchen Mar 18, 2025
d767920
Update vision.py
danielhanchen Mar 18, 2025
ea19392
Update vision.py
danielhanchen Mar 18, 2025
9486268
Update rl_replacements.py
danielhanchen Mar 18, 2025
e87368f
Update rl_replacements.py
danielhanchen Mar 18, 2025
2a620fc
Update rl_replacements.py
danielhanchen Mar 18, 2025
8d2885f
Update rl_replacements.py
danielhanchen Mar 18, 2025
b9e3455
Update vision.py
danielhanchen Mar 18, 2025
ce766f2
Update vision.py
danielhanchen Mar 18, 2025
beed394
Update vision.py
danielhanchen Mar 18, 2025
a09f3dc
Update vision.py
danielhanchen Mar 18, 2025
45377be
Update vision.py
danielhanchen Mar 18, 2025
558b052
Update rl_replacements.py
danielhanchen Mar 18, 2025
800a465
Update vision.py
danielhanchen Mar 18, 2025
8753a59
Update rl_replacements.py
danielhanchen Mar 18, 2025
0f73f12
Merge branch 'main' into nightly
danielhanchen Mar 18, 2025
2c41fc9
Update vision.py
danielhanchen Mar 18, 2025
645493d
Update vision.py
danielhanchen Mar 19, 2025
f19967e
Update vision.py
danielhanchen Mar 19, 2025
0f20d66
Update vision.py
danielhanchen Mar 19, 2025
369ce00
Update vision.py
danielhanchen Mar 19, 2025
1098955
Update vision.py
danielhanchen Mar 19, 2025
c6b956f
Remove double generate patch
danielhanchen Mar 19, 2025
d1ee347
Update vision.py
danielhanchen Mar 19, 2025
9e04f88
Update vision.py
danielhanchen Mar 19, 2025
36c052c
Update vision.py
danielhanchen Mar 19, 2025
8f3658a
Update vision.py
danielhanchen Mar 19, 2025
8aaaa44
Update vision.py
danielhanchen Mar 19, 2025
0b95576
Update mapper.py
danielhanchen Mar 19, 2025
cca0d38
Update vision.py
danielhanchen Mar 19, 2025
7d47557
fix: config.torch_dtype in LlamaModel_fast_forward_inference (#2091)
lurf21 Mar 19, 2025
50490c0
versioning
danielhanchen Mar 19, 2025
fd150a1
Merge branch 'nightly' of https://github.com/unslothai/unsloth into n…
danielhanchen Mar 19, 2025
a38e5cb
Update vision.py
danielhanchen Mar 19, 2025
58f3c94
Update vision.py
danielhanchen Mar 19, 2025
d2f1688
Update vision.py
danielhanchen Mar 19, 2025
b785bf6
Update vision.py
danielhanchen Mar 19, 2025
418ad9a
Update vision.py
danielhanchen Mar 19, 2025
88f8a2e
Update vision.py
danielhanchen Mar 19, 2025
95b4e83
Update vision.py
danielhanchen Mar 19, 2025
2ef2724
Update vision.py
danielhanchen Mar 19, 2025
1b2b2d2
Update vision.py
danielhanchen Mar 19, 2025
8fda1f0
Update vision.py
danielhanchen Mar 19, 2025
3bbdb99
model_type_arch
danielhanchen Mar 19, 2025
e7128de
Update vision.py
danielhanchen Mar 19, 2025
37dd658
Update vision.py
danielhanchen Mar 19, 2025
d1edf54
Update vision.py
danielhanchen Mar 19, 2025
a9cbff5
Update vision.py
danielhanchen Mar 19, 2025
d45b1b1
Update vision.py
danielhanchen Mar 19, 2025
013b185
Update vision.py
danielhanchen Mar 19, 2025
03e91ef
Merge branch 'main' into nightly
danielhanchen Mar 19, 2025
7c71307
Merge branch 'main' into nightly
danielhanchen Mar 19, 2025
33d1b8f
Update loader.py
danielhanchen Mar 19, 2025
8ad7e95
check
danielhanchen Mar 19, 2025
d40ebf6
Update _utils.py
danielhanchen Mar 19, 2025
167b4bd
Update loader.py
danielhanchen Mar 19, 2025
67d169a
Update loader.py
danielhanchen Mar 19, 2025
cf949ba
Remove prints
danielhanchen Mar 19, 2025
9ec6833
Update README.md
jackswl Mar 20, 2025
3e8149d
Merge branch 'main' into nightly
danielhanchen Mar 21, 2025
a747009
Update _utils.py
danielhanchen Mar 21, 2025
372979e
Update _utils.py
danielhanchen Mar 21, 2025
8bffb7a
versioning
danielhanchen Mar 21, 2025
cd49eaf
Update _utils.py
danielhanchen Mar 21, 2025
d94e161
Update _utils.py
danielhanchen Mar 21, 2025
2d4c407
Update _utils.py
danielhanchen Mar 21, 2025
fa910ab
Update llama.py
danielhanchen Mar 21, 2025
7cd95f5
Update llama.py
danielhanchen Mar 21, 2025
a0ebbb2
Update llama.py
danielhanchen Mar 21, 2025
6b5bab8
Update llama.py
danielhanchen Mar 21, 2025
b728a01
Update llama.py
danielhanchen Mar 21, 2025
25ca0f8
Update llama.py
danielhanchen Mar 21, 2025
6de5694
Update llama.py
danielhanchen Mar 21, 2025
f63306b
Update llama.py
danielhanchen Mar 21, 2025
f016b01
Update llama.py
danielhanchen Mar 21, 2025
b5f6727
Update llama.py
danielhanchen Mar 21, 2025
1718438
Update llama.py
danielhanchen Mar 21, 2025
6ff1aa2
Update llama.py
danielhanchen Mar 21, 2025
f26f772
Update llama.py
danielhanchen Mar 21, 2025
18ab3c1
Update llama.py
danielhanchen Mar 21, 2025
38dd9d1
Update llama.py
danielhanchen Mar 22, 2025
ebb10cd
Update llama.py
danielhanchen Mar 22, 2025
beecad0
Update llama.py
danielhanchen Mar 22, 2025
e716e15
Update llama.py
danielhanchen Mar 22, 2025
62e4ae5
Update llama.py
danielhanchen Mar 22, 2025
1eba050
Update llama.py
danielhanchen Mar 22, 2025
a015c38
Update llama.py
danielhanchen Mar 22, 2025
0c995e8
Update llama.py
danielhanchen Mar 22, 2025
5ba0878
Update llama.py
danielhanchen Mar 22, 2025
cd5e195
Update llama.py
danielhanchen Mar 22, 2025
855695d
Update llama.py
danielhanchen Mar 22, 2025
4d7e3a1
Update vision.py
danielhanchen Mar 22, 2025
33194f1
HF Transfer
danielhanchen Mar 22, 2025
ef71732
fix(utils): add missing importlib import to fix NameError (#2134)
naliazheli Mar 22, 2025
1d7b570
Add QLoRA Train and Merge16bit Test (#2130)
jeromeku Mar 22, 2025
167b482
Update pyproject.toml
danielhanchen Mar 22, 2025
d28b929
Merge branch 'main' into nightly
danielhanchen Mar 22, 2025
2064656
Merge branch 'main' into nightly
danielhanchen Mar 22, 2025
3fdfff8
Update vision.py
danielhanchen Mar 26, 2025
172fe3c
Update vision.py
danielhanchen Mar 26, 2025
da6ad9f
Update vision.py
danielhanchen Mar 26, 2025
781887f
Update vision.py
danielhanchen Mar 26, 2025
fce9e82
Update loader.py
danielhanchen Mar 26, 2025
9ceabbe
Update loader.py
danielhanchen Mar 26, 2025
87dc533
Revert
danielhanchen Mar 26, 2025
cafd05e
Update vision.py
danielhanchen Mar 26, 2025
6ebcae0
Update vision.py
danielhanchen Mar 26, 2025
9f34d47
Update vision.py
danielhanchen Mar 26, 2025
26b0c83
Update vision.py
danielhanchen Mar 26, 2025
f9dd304
Update vision.py
danielhanchen Mar 26, 2025
10cfe62
Bug fix
danielhanchen Mar 26, 2025
bfa1b9f
Update mapper.py
danielhanchen Mar 26, 2025
b3c2975
check SDPA for Mistral 3, Pixtral
danielhanchen Mar 26, 2025
75ce106
Update vision.py
danielhanchen Mar 26, 2025
86c6060
Versioning
danielhanchen Mar 26, 2025
d4c0550
Update rl_replacements.py
danielhanchen Mar 26, 2025
c493054
Merge branch 'main' into nightly
danielhanchen Mar 26, 2025
0b2b903
Update README.md
jackswl Mar 26, 2025
f6dfa80
add model registry
jeromeku Mar 28, 2025
a5e7b3a
move hf hub utils to unsloth/utils
jeromeku Mar 28, 2025
dc8f34e
refactor global model info dicts to dataclasses
jeromeku Mar 30, 2025
7cd2763
fix dataclass init
jeromeku Mar 30, 2025
9899a72
fix llama registration
jeromeku Mar 30, 2025
310c598
remove deprecated key function
jeromeku Mar 30, 2025
e70d035
start registry reog
jeromeku Mar 30, 2025
de1fe25
add llama vision
jeromeku Mar 30, 2025
7e2207c
quant types -> Enum
jeromeku Mar 30, 2025
c3a1aff
remap literal quant types to QuantType Enum
jeromeku Mar 30, 2025
03de6df
add llama model registration
jeromeku Mar 30, 2025
fa95aa0
fix quant tag mapping
jeromeku Mar 30, 2025
fdafa78
add qwen2.5 models to registry
jeromeku Mar 31, 2025
6049310
add option to include original model in registry
jeromeku Mar 31, 2025
8dc3d66
handle quant types per model size
jeromeku Mar 31, 2025
1237075
separate registration of base and instruct llama3.2
jeromeku Mar 31, 2025
baab018
add QwenQVQ to registry
jeromeku Mar 31, 2025
6b08fc3
add gemma3 to registry
jeromeku Mar 31, 2025
44e227b
add phi
jeromeku Mar 31, 2025
d633179
add deepseek v3
jeromeku Mar 31, 2025
0755b45
add deepseek r1 base
jeromeku Mar 31, 2025
17358e6
add deepseek r1 zero
jeromeku Mar 31, 2025
975d263
add deepseek distill llama
jeromeku Mar 31, 2025
229ae10
add deepseek distill models
jeromeku Mar 31, 2025
6439e88
remove redundant code when constructing model names
jeromeku Mar 31, 2025
4e1df71
add mistral small to registry
jeromeku Mar 31, 2025
6d4ede4
rename model registration methods
jeromeku Apr 1, 2025
a774726
rename deepseek registration methods
jeromeku Apr 1, 2025
a2a4366
refactor naming for mistral and phi
jeromeku Apr 1, 2025
02fbb87
add global register models
jeromeku Apr 1, 2025
7fbde42
refactor model registration tests for new registry apis
jeromeku Apr 1, 2025
a2d3ad9
add model search method
jeromeku Apr 1, 2025
13a1126
remove deprecated registration api
jeromeku Apr 1, 2025
4840a32
add quant type test
jeromeku Apr 1, 2025
7d64639
add registry readme
jeromeku Apr 1, 2025
12b0d32
make llama registration more specific
jeromeku Apr 1, 2025
ea75001
clear registry when executing individual model registration file
jeromeku Apr 1, 2025
d854070
more registry readme updates
jeromeku Apr 1, 2025
2a4a274
Merge branch 'main' into nightly
danielhanchen Apr 1, 2025
03ab51d
Merge pull request #2255 from jeromeku/registry-refactor
shimmyshimmer Apr 2, 2025
0c95691
Merge pull request #2119 from jackswl/patch-1
shimmyshimmer Apr 3, 2025
0c1b3ff
Update _auto_install.py
danielhanchen Apr 5, 2025
d5e1880
Llama4
danielhanchen Apr 6, 2025
56f14e8
Merge branch 'main' into nightly
danielhanchen Apr 10, 2025
1d10f0e
Merge branch 'main' into nightly
danielhanchen Apr 20, 2025
cc2c02c
Merge branch 'main' into nightly
danielhanchen Apr 26, 2025
6dbf677
Merge branch 'main' into nightly
danielhanchen Apr 30, 2025
98177a0
Update synthetic.py
danielhanchen Apr 30, 2025
c217c75
Update synthetic.py
danielhanchen Apr 30, 2025
49d610e
Update synthetic.py
danielhanchen Apr 30, 2025
63698fc
Update synthetic.py
danielhanchen Apr 30, 2025
5b138c7
Update synthetic.py
danielhanchen Apr 30, 2025
c5d632a
Update synthetic.py
danielhanchen Apr 30, 2025
d25f93c
Update synthetic.py
danielhanchen Apr 30, 2025
ad45d26
Update synthetic.py
danielhanchen Apr 30, 2025
4874c72
Update synthetic.py
danielhanchen Apr 30, 2025
95f595a
Update synthetic.py
danielhanchen Apr 30, 2025
de0dbc6
Update synthetic.py
danielhanchen Apr 30, 2025
0ea2279
Synthetic data
danielhanchen Apr 30, 2025
3329c77
Merge branch 'main' into nightly
danielhanchen Apr 30, 2025
d1845c7
Update mapper.py
danielhanchen Apr 30, 2025
64d21f8
Xet and Synthetic
danielhanchen Apr 30, 2025
f522381
Update synthetic.py
danielhanchen Apr 30, 2025
9687fb3
Update loader.py
danielhanchen Apr 30, 2025
0d323a3
Update synthetic.py
danielhanchen Apr 30, 2025
c49d5ff
Update synthetic.py
danielhanchen Apr 30, 2025
c48079b
Update synthetic.py
danielhanchen Apr 30, 2025
1dd6034
Update synthetic.py
danielhanchen Apr 30, 2025
9ae987c
Update synthetic.py
danielhanchen Apr 30, 2025
ccf7065
Update synthetic.py
danielhanchen Apr 30, 2025
376cb9a
Update synthetic.py
danielhanchen Apr 30, 2025
9827a68
Update synthetic.py
danielhanchen Apr 30, 2025
9e6b59e
Update synthetic.py
danielhanchen Apr 30, 2025
fd9f3dc
Update synthetic.py
danielhanchen Apr 30, 2025
3f346e7
Update synthetic.py
danielhanchen Apr 30, 2025
74f42ba
Update synthetic.py
danielhanchen Apr 30, 2025
6dc3383
Update synthetic.py
danielhanchen Apr 30, 2025
7e3849f
Update synthetic.py
danielhanchen Apr 30, 2025
afcbb2c
Update synthetic.py
danielhanchen Apr 30, 2025
49b3343
Update synthetic.py
danielhanchen Apr 30, 2025
f3475b4
Update synthetic.py
danielhanchen Apr 30, 2025
7d5a8b3
Update synthetic.py
danielhanchen Apr 30, 2025
c50c039
Update synthetic.py
danielhanchen Apr 30, 2025
e85e987
Update synthetic.py
danielhanchen Apr 30, 2025
270f02f
Update synthetic.py
danielhanchen Apr 30, 2025
5a05158
Update synthetic.py
danielhanchen Apr 30, 2025
a536173
Update synthetic.py
danielhanchen Apr 30, 2025
90783f7
Update synthetic.py
danielhanchen Apr 30, 2025
eb37b78
Update synthetic.py
danielhanchen Apr 30, 2025
ecdd496
Update synthetic.py
danielhanchen Apr 30, 2025
050306f
Update synthetic.py
danielhanchen Apr 30, 2025
b7ac229
Update pyproject.toml
danielhanchen May 1, 2025
0ee8529
Delete .gitignore
danielhanchen May 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ triton = [
]

huggingface = [
"unsloth_zoo>=2025.4.2",
"unsloth_zoo>=2025.4.3",
"packaging",
"tyro",
"transformers>=4.46.1,!=4.47.0",
Expand Down Expand Up @@ -351,7 +351,7 @@ colab-ampere-torch220 = [
"flash-attn>=2.6.3",
]
colab-new = [
"unsloth_zoo>=2025.4.2",
"unsloth_zoo>=2025.4.3",
"packaging",
"tyro",
"transformers>=4.46.1,!=4.47.0",
Expand Down
Empty file added tests/__init__.py
Empty file.
91 changes: 91 additions & 0 deletions tests/test_model_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"""

Test model registration methods
Checks that model registration methods work for respective models as well as all models
The check is performed
- by registering the models
- checking that the instantiated models can be found on huggingface hub by querying for the model id

"""

from dataclasses import dataclass

import pytest
from huggingface_hub import ModelInfo as HfModelInfo

from unsloth.registry import register_models, search_models
from unsloth.registry._deepseek import register_deepseek_models
from unsloth.registry._gemma import register_gemma_models
from unsloth.registry._llama import register_llama_models
from unsloth.registry._mistral import register_mistral_models
from unsloth.registry._phi import register_phi_models
from unsloth.registry._qwen import register_qwen_models
from unsloth.registry.registry import MODEL_REGISTRY, QUANT_TAG_MAP, QuantType
from unsloth.utils.hf_hub import get_model_info

MODEL_NAMES = [
"llama",
"qwen",
"mistral",
"phi",
"gemma",
"deepseek",
]
MODEL_REGISTRATION_METHODS = [
register_llama_models,
register_qwen_models,
register_mistral_models,
register_phi_models,
register_gemma_models,
register_deepseek_models,
]


@dataclass
class ModelTestParam:
name: str
register_models: callable


def _test_model_uploaded(model_ids: list[str]):
missing_models = []
for _id in model_ids:
model_info: HfModelInfo = get_model_info(_id)
if not model_info:
missing_models.append(_id)

return missing_models


TestParams = [
ModelTestParam(name, models)
for name, models in zip(MODEL_NAMES, MODEL_REGISTRATION_METHODS)
]


# Test that model registration methods register respective models
@pytest.mark.parametrize("model_test_param", TestParams, ids=lambda param: param.name)
def test_model_registration(model_test_param: ModelTestParam):
MODEL_REGISTRY.clear()
registration_method = model_test_param.register_models
registration_method()
registered_models = MODEL_REGISTRY.keys()
missing_models = _test_model_uploaded(registered_models)
assert not missing_models, (
f"{model_test_param.name} missing following models: {missing_models}"
)


def test_all_model_registration():
register_models()
registered_models = MODEL_REGISTRY.keys()
missing_models = _test_model_uploaded(registered_models)
assert not missing_models, f"Missing following models: {missing_models}"

def test_quant_type():
# Test that the quant_type is correctly set for model paths
# NOTE: for models registered under org="unsloth" with QuantType.NONE aliases QuantType.UNSLOTH
dynamic_quant_models = search_models(quant_types=[QuantType.UNSLOTH])
assert all(m.quant_type == QuantType.UNSLOTH for m in dynamic_quant_models)
quant_tag = QUANT_TAG_MAP[QuantType.UNSLOTH]
assert all(quant_tag in m.model_path for m in dynamic_quant_models)
3 changes: 2 additions & 1 deletion unsloth/_auto_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
v = V(torch.__version__)
cuda = str(torch.version.cuda)
is_ampere = torch.cuda.get_device_capability()[0] >= 8
if cuda != "12.1" and cuda != "11.8" and cuda != "12.4" and cuda != "12.6": raise RuntimeError(f"CUDA = {cuda} not supported!")
if cuda != "12.1" and cuda != "11.8" and cuda != "12.4" and cuda != "12.6" and cuda != "12.8": raise RuntimeError(f"CUDA = {cuda} not supported!")
if v <= V('2.1.0'): raise RuntimeError(f"Torch = {v} too old!")
elif v <= V('2.1.1'): x = 'cu{}{}-torch211'
elif v <= V('2.1.2'): x = 'cu{}{}-torch212'
Expand All @@ -28,6 +28,7 @@
elif v < V('2.5.1'): x = 'cu{}{}-torch250'
elif v <= V('2.5.1'): x = 'cu{}{}-torch251'
elif v < V('2.7.0'): x = 'cu{}{}-torch260'
elif v < V('2.8.0'): x = 'cu{}{}-torch270'
else: raise RuntimeError(f"Torch = {v} too new!")
x = x.format(cuda.replace(".", ""), "-ampere" if is_ampere else "")
print(f'pip install --upgrade pip && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git"')
Loading