Skip to content
Merged
Changes from all commits
Commits
Show all changes
760 commits
Select commit Hold shift + click to select a range
ca0b499
Update compiler.py
danielhanchen Mar 14, 2025
4908a16
Update compiler.py
danielhanchen Mar 14, 2025
1d4b5d7
Update compiler.py
danielhanchen Mar 14, 2025
81b45c6
Update saving_utils.py
danielhanchen Mar 14, 2025
261ffd2
Update llama_cpp.py
danielhanchen Mar 14, 2025
2ed281a
Update llama_cpp.py
danielhanchen Mar 14, 2025
d89a8fa
Update saving_utils.py
danielhanchen Mar 14, 2025
106736a
Update saving_utils.py
danielhanchen Mar 14, 2025
4abfdcd
Update __init__.py
danielhanchen Mar 14, 2025
0ac4464
Update compiler.py
danielhanchen Mar 14, 2025
e2fbe79
Update loss_utils.py
danielhanchen Mar 14, 2025
82665d4
Update compiler.py
danielhanchen Mar 14, 2025
9b6142e
Update loss_utils.py
danielhanchen Mar 14, 2025
ee92817
Update loss_utils.py
danielhanchen Mar 14, 2025
9b7600d
Update llama_cpp.py
danielhanchen Mar 14, 2025
d5b6d1c
Update loss_utils.py
danielhanchen Mar 14, 2025
86516ad
Update compiler.py
danielhanchen Mar 14, 2025
29553e4
Update llama_cpp.py
danielhanchen Mar 14, 2025
33e6c8e
Update compiler.py
danielhanchen Mar 14, 2025
5202605
Update vllm_utils.py
danielhanchen Mar 14, 2025
ca52896
Update rl_replacements.py
danielhanchen Mar 14, 2025
7baa442
Update rl_replacements.py
danielhanchen Mar 14, 2025
7ff5a1a
Update rl_replacements.py
danielhanchen Mar 14, 2025
e80aa10
Update rl_replacements.py
danielhanchen Mar 14, 2025
e93d93f
Update rl_replacements.py
danielhanchen Mar 14, 2025
9a6c231
Update rl_replacements.py
danielhanchen Mar 14, 2025
c8abd45
Update training_utils.py
danielhanchen Mar 14, 2025
1633c78
Merge branch 'main' into nightly
danielhanchen Mar 15, 2025
964129b
Update dataset_utils.py
danielhanchen Mar 15, 2025
3b690ad
Update dataset_utils.py
danielhanchen Mar 16, 2025
7bb4a13
Revert "Update dataset_utils.py"
danielhanchen Mar 16, 2025
947c5e9
Update temporary_patches.py
danielhanchen Mar 16, 2025
2fe9c6c
Update temporary_patches.py
danielhanchen Mar 16, 2025
0b2dc97
Update temporary_patches.py
danielhanchen Mar 16, 2025
b9a96dc
Update temporary_patches.py
danielhanchen Mar 16, 2025
0784a07
Update temporary_patches.py
danielhanchen Mar 16, 2025
80c2dc8
Update temporary_patches.py
danielhanchen Mar 16, 2025
26c817d
Update compiler.py
danielhanchen Mar 16, 2025
d3cdd17
Update compiler.py
danielhanchen Mar 16, 2025
31e778a
Remove prints
danielhanchen Mar 16, 2025
2c6a3c5
Update compiler.py
danielhanchen Mar 16, 2025
f3f3c9c
Update saving_utils.py
danielhanchen Mar 16, 2025
93b6a88
Update temporary_patches.py
danielhanchen Mar 16, 2025
86aee5c
Update __init__.py
danielhanchen Mar 16, 2025
ac38bff
Update pyproject.toml
danielhanchen Mar 16, 2025
f64e153
Update vllm_utils.py
danielhanchen Mar 16, 2025
4c72e79
bug fix #2008 unsloth issue - load_in_4bit = True + fast_inference = …
void-mckenzie Mar 16, 2025
1974798
Update dataset_utils.py
danielhanchen Mar 16, 2025
4df4417
Merge branch 'nightly' of https://github.com/unslothai/unsloth-zoo in…
danielhanchen Mar 16, 2025
a5c20e1
Update compiler.py
danielhanchen Mar 17, 2025
a434d45
Update temporary_patches.py
danielhanchen Mar 17, 2025
3cfb98f
Gemma 3 fixes
danielhanchen Mar 17, 2025
fc5f1c0
Update temporary_patches.py
danielhanchen Mar 17, 2025
b317e90
Update compiler.py
danielhanchen Mar 17, 2025
4121dd0
Update compiler.py
danielhanchen Mar 17, 2025
c59dcde
Gemma 3 fixes
danielhanchen Mar 17, 2025
d98ae2e
Update patching_utils.py
danielhanchen Mar 17, 2025
3073ea3
Update compiler.py
danielhanchen Mar 17, 2025
57ff5f6
Update compiler.py
danielhanchen Mar 17, 2025
c7e803b
Update patching_utils.py
danielhanchen Mar 17, 2025
3daaf0d
Update temporary_patches.py
danielhanchen Mar 17, 2025
b619b58
Update compiler.py
danielhanchen Mar 17, 2025
4e78082
Update compiler.py
danielhanchen Mar 17, 2025
c8ba677
Update temporary_patches.py
danielhanchen Mar 17, 2025
fb68ecc
Update temporary_patches.py
danielhanchen Mar 17, 2025
e5a73fe
Update temporary_patches.py
danielhanchen Mar 17, 2025
d7bbe30
Update temporary_patches.py
danielhanchen Mar 17, 2025
5f99275
Update temporary_patches.py
danielhanchen Mar 17, 2025
346812f
Update temporary_patches.py
danielhanchen Mar 17, 2025
b907d0c
Update temporary_patches.py
danielhanchen Mar 17, 2025
789171c
Update temporary_patches.py
danielhanchen Mar 17, 2025
4e2c94a
Update compiler.py
danielhanchen Mar 17, 2025
4740c99
Update compiler.py
danielhanchen Mar 17, 2025
4658d94
Update compiler.py
danielhanchen Mar 17, 2025
f9de6e9
Update compiler.py
danielhanchen Mar 17, 2025
dbdbc63
Update compiler.py
danielhanchen Mar 17, 2025
55b1963
Update compiler.py
danielhanchen Mar 17, 2025
e997ee1
Update compiler.py
danielhanchen Mar 17, 2025
0ba033f
Update compiler.py
danielhanchen Mar 17, 2025
bf821ba
Update compiler.py
danielhanchen Mar 17, 2025
d8c6e59
Update compiler.py
danielhanchen Mar 17, 2025
9967ce3
Update compiler.py
danielhanchen Mar 17, 2025
7b0c535
Update compiler.py
danielhanchen Mar 17, 2025
e6859ce
Update compiler.py
danielhanchen Mar 17, 2025
b2a8f47
Update compiler.py
danielhanchen Mar 17, 2025
ca79c93
Update compiler.py
danielhanchen Mar 17, 2025
3f67ed6
Update compiler.py
danielhanchen Mar 17, 2025
e5fb044
Update compiler.py
danielhanchen Mar 18, 2025
4a1bf2f
Update compiler.py
danielhanchen Mar 18, 2025
36ec4ee
Update compiler.py
danielhanchen Mar 18, 2025
7d1dc81
compiler
danielhanchen Mar 18, 2025
16d6137
Update gradient_checkpointing.py
danielhanchen Mar 18, 2025
9b78566
Update temporary_patches.py
danielhanchen Mar 18, 2025
e0edefe
Update temporary_patches.py
danielhanchen Mar 18, 2025
719e379
Update temporary_patches.py
danielhanchen Mar 18, 2025
8beb2b7
Update temporary_patches.py
danielhanchen Mar 18, 2025
f9cf701
Update temporary_patches.py
danielhanchen Mar 18, 2025
aa8848c
Update temporary_patches.py
danielhanchen Mar 18, 2025
ee940a9
Update temporary_patches.py
danielhanchen Mar 18, 2025
d086158
Update temporary_patches.py
danielhanchen Mar 18, 2025
5a43de2
Update temporary_patches.py
danielhanchen Mar 18, 2025
1f6589b
Update temporary_patches.py
danielhanchen Mar 18, 2025
9b904a9
Update temporary_patches.py
danielhanchen Mar 18, 2025
3c0504b
Update temporary_patches.py
danielhanchen Mar 18, 2025
417161e
Update temporary_patches.py
danielhanchen Mar 18, 2025
3f024b6
Update temporary_patches.py
danielhanchen Mar 18, 2025
b0bd2f4
Update temporary_patches.py
danielhanchen Mar 18, 2025
640e071
Update temporary_patches.py
danielhanchen Mar 18, 2025
05c2232
Update temporary_patches.py
danielhanchen Mar 18, 2025
593eecb
Update temporary_patches.py
danielhanchen Mar 18, 2025
e9c935f
Update temporary_patches.py
danielhanchen Mar 18, 2025
b71160c
causal mask dtype
danielhanchen Mar 18, 2025
a6fedb6
Fix checkpoint and save from local file (#74)
Erland366 Mar 18, 2025
c566b02
Update patching_utils.py
danielhanchen Mar 18, 2025
aaf5feb
Merge branch 'nightly' of https://github.com/unslothai/unsloth-zoo in…
danielhanchen Mar 18, 2025
94f5f4f
Update patching_utils.py
danielhanchen Mar 18, 2025
26c67cf
Update temporary_patches.py
danielhanchen Mar 18, 2025
d92bab6
Update temporary_patches.py
danielhanchen Mar 18, 2025
b04cf4b
Update compiler.py
danielhanchen Mar 18, 2025
4565db3
Update loss_utils.py
danielhanchen Mar 18, 2025
e368810
Update compiler.py
danielhanchen Mar 18, 2025
ce07e0f
Update vllm_utils.py
danielhanchen Mar 18, 2025
114150d
Update compiler.py
danielhanchen Mar 18, 2025
6bd69f1
Update peft_utils.py
danielhanchen Mar 18, 2025
9cee216
Update rl_replacements.py
danielhanchen Mar 18, 2025
df8ac03
Update vllm_utils.py
danielhanchen Mar 18, 2025
e5a321f
Update temporary_patches.py
danielhanchen Mar 18, 2025
134857d
Update temporary_patches.py
danielhanchen Mar 18, 2025
dec6433
Update temporary_patches.py
danielhanchen Mar 18, 2025
b14149b
Update temporary_patches.py
danielhanchen Mar 18, 2025
07f7dde
Update temporary_patches.py
danielhanchen Mar 18, 2025
7600d35
Update temporary_patches.py
danielhanchen Mar 18, 2025
679edeb
Update temporary_patches.py
danielhanchen Mar 18, 2025
5fd25ec
Update temporary_patches.py
danielhanchen Mar 18, 2025
a884b3c
Update temporary_patches.py
danielhanchen Mar 18, 2025
b6ab8bd
Update temporary_patches.py
danielhanchen Mar 18, 2025
cc3ca48
Update temporary_patches.py
danielhanchen Mar 18, 2025
9f5b67d
Update temporary_patches.py
danielhanchen Mar 18, 2025
e4980b2
Update temporary_patches.py
danielhanchen Mar 18, 2025
d745fb7
Update temporary_patches.py
danielhanchen Mar 18, 2025
201c1ab
Merge branch 'main' into nightly
danielhanchen Mar 18, 2025
2fb83f0
Update compiler.py
danielhanchen Mar 18, 2025
3551715
Update vllm_lora_worker_manager.py
danielhanchen Mar 19, 2025
ab47b77
Update utils.py
danielhanchen Mar 19, 2025
ceed6ab
Update temporary_patches.py
danielhanchen Mar 19, 2025
b5611c2
Update temporary_patches.py
danielhanchen Mar 19, 2025
480aaf7
Update temporary_patches.py
danielhanchen Mar 19, 2025
637c7ad
Update temporary_patches.py
danielhanchen Mar 19, 2025
5a224bb
Update temporary_patches.py
danielhanchen Mar 19, 2025
2248156
Update temporary_patches.py
danielhanchen Mar 19, 2025
ee6ed2b
Update temporary_patches.py
danielhanchen Mar 19, 2025
6d10b9b
Update temporary_patches.py
danielhanchen Mar 19, 2025
9d431b0
Update temporary_patches.py
danielhanchen Mar 19, 2025
42491ca
Update temporary_patches.py
danielhanchen Mar 19, 2025
d3ddadf
Update vllm_utils.py
danielhanchen Mar 19, 2025
dbc6a43
Update vllm_utils.py
danielhanchen Mar 19, 2025
0c4b0d2
Update vllm_utils.py
danielhanchen Mar 19, 2025
5504033
Update vllm_utils.py
danielhanchen Mar 19, 2025
2a84e79
Update dataset_utils.py
danielhanchen Mar 19, 2025
cbbc4a3
bidirectional attention
danielhanchen Mar 19, 2025
3bf532d
Update vllm_utils.py
danielhanchen Mar 19, 2025
8e687b5
Update __init__.py
danielhanchen Mar 19, 2025
a723520
Update temporary_patches.py
danielhanchen Mar 19, 2025
9d1dd42
Update temporary_patches.py
danielhanchen Mar 19, 2025
aec2701
Update temporary_patches.py
danielhanchen Mar 19, 2025
23a3a59
Update vllm_utils.py
danielhanchen Mar 19, 2025
2874477
Update vllm_utils.py
danielhanchen Mar 19, 2025
7d40491
Update vllm_utils.py
danielhanchen Mar 19, 2025
2275642
Update vllm_utils.py
danielhanchen Mar 19, 2025
9cd348f
Update vllm_utils.py
danielhanchen Mar 19, 2025
6e33fa9
Update vllm_utils.py
danielhanchen Mar 19, 2025
7ad0f55
Update vllm_lora_worker_manager.py
danielhanchen Mar 19, 2025
7fd23a0
Update vllm_lora_worker_manager.py
danielhanchen Mar 19, 2025
9176758
Update vllm_lora_worker_manager.py
danielhanchen Mar 19, 2025
b5a38b0
Merge branch 'main' into nightly
danielhanchen Mar 19, 2025
446787d
Merge branch 'main' into nightly
danielhanchen Mar 19, 2025
d2bdd9b
Update temporary_patches.py
danielhanchen Mar 19, 2025
83bde7d
Update temporary_patches.py
danielhanchen Mar 19, 2025
0fe9eaa
Update temporary_patches.py
danielhanchen Mar 19, 2025
3d70a80
Update temporary_patches.py
danielhanchen Mar 19, 2025
6b6587d
Merge branch 'main' into nightly
danielhanchen Mar 21, 2025
88301c5
Update loss_utils.py
danielhanchen Mar 21, 2025
debc0e8
Update loss_utils.py
danielhanchen Mar 21, 2025
7dc2e9d
Update loss_utils.py
danielhanchen Mar 21, 2025
57b4973
Update loss_utils.py
danielhanchen Mar 21, 2025
3cfa271
Update loss_utils.py
danielhanchen Mar 21, 2025
1f5b6f2
Update __init__.py
danielhanchen Mar 21, 2025
2f3c87b
fix: AsyncLLMEngine bugs (#82)
bradhilton Mar 22, 2025
64dd76c
fixed a typo in L119, removing unnecessary len() (#84)
SpaceHunterInf Mar 22, 2025
5a1a2b5
Merge branch 'main' into nightly
danielhanchen Mar 22, 2025
a62e4c6
Fix gradient checkpointing warning filter implementation
rolandtannous Mar 24, 2025
d115cea
Input grads fix for gemma3 (#96)
mmathew23 Mar 25, 2025
454757c
Merge pull request #97 from rolandtannous/fix/suppress-gradient-check…
shimmyshimmer Mar 25, 2025
c50123a
Update vision_utils.py
danielhanchen Mar 26, 2025
b199491
Vision requires grad
danielhanchen Mar 26, 2025
1670fa6
Check SDPA for Mistral / Pixtral
danielhanchen Mar 26, 2025
e32f797
Update compiler.py
danielhanchen Mar 26, 2025
b9d9cc5
Update vision_utils.py
danielhanchen Mar 26, 2025
5e3c88f
Update vision_utils.py
danielhanchen Mar 26, 2025
5c4086c
Update vision_utils.py
danielhanchen Mar 26, 2025
0599242
Update __init__.py
danielhanchen Mar 26, 2025
8da5939
Update vision_utils.py
danielhanchen Mar 26, 2025
db90dca
Update vision_utils.py
danielhanchen Mar 26, 2025
51cefe5
Update vision_utils.py
danielhanchen Mar 26, 2025
20b42ce
Update vision_utils.py
danielhanchen Mar 26, 2025
b03ded6
Update vision_utils.py
danielhanchen Mar 26, 2025
65469c2
Update vision_utils.py
danielhanchen Mar 26, 2025
7f4eb00
Update vision_utils.py
danielhanchen Mar 26, 2025
8584b5d
Update vision_utils.py
danielhanchen Mar 26, 2025
8bb6b55
Update vision_utils.py
danielhanchen Mar 26, 2025
20a61b0
Update vision_utils.py
danielhanchen Mar 26, 2025
86ca6d5
Update vision_utils.py
danielhanchen Mar 26, 2025
0221094
Update vision_utils.py
danielhanchen Mar 26, 2025
d13ebf7
Update vision_utils.py
danielhanchen Mar 26, 2025
f6c4b2e
Update vision_utils.py
danielhanchen Mar 26, 2025
2d1e506
Update vllm_utils.py (#99)
5k5000 Mar 26, 2025
23e018f
Update vision_utils.py
danielhanchen Mar 26, 2025
9f1eaa2
Fixes to support IterableDataset (#98)
marcandrelarochelle Mar 26, 2025
affb9d8
Merge branch 'nightly' of https://github.com/unslothai/unsloth-zoo in…
danielhanchen Mar 26, 2025
1efc541
Merge branch 'main' into nightly
danielhanchen Mar 26, 2025
6ae6d0e
Merge branch 'main' into nightly
danielhanchen May 6, 2025
8986b95
Update vllm_utils.py
danielhanchen May 6, 2025
d37ed39
Create vllm_rlhf_utils.py
danielhanchen May 6, 2025
abf388b
Update vllm_rlhf_utils.py
danielhanchen May 6, 2025
6ff1836
Update vllm_rlhf_utils.py
danielhanchen May 6, 2025
deea45f
Update vllm_rlhf_utils.py
danielhanchen May 6, 2025
4ae4dd6
Update vllm_rlhf_utils.py
danielhanchen May 7, 2025
8dcff39
Update vllm_rlhf_utils.py
danielhanchen May 7, 2025
6edc24c
Update vllm_rlhf_utils.py
danielhanchen May 7, 2025
e61ad9b
Update vllm_rlhf_utils.py
danielhanchen May 7, 2025
f74ba8e
Update vllm_rlhf_utils.py
danielhanchen May 8, 2025
ee5bb55
Update vllm_rlhf_utils.py
danielhanchen May 8, 2025
994533c
vLLM for Qwen 3
danielhanchen May 11, 2025
23d8aa7
Merge branch 'main' into nightly
danielhanchen May 11, 2025
569c3ae
Update vllm_utils.py
danielhanchen May 11, 2025
847ad07
Update vllm_utils.py
danielhanchen May 11, 2025
121ff4b
Merge branch 'main' into nightly
danielhanchen May 11, 2025
58d4084
Update vllm_utils.py
danielhanchen May 11, 2025
a1b4cbe
Update vllm_utils.py
danielhanchen May 11, 2025
18c96f1
Update vllm_utils.py
danielhanchen May 11, 2025
d38bdef
Update vllm_utils.py
danielhanchen May 11, 2025
0828b02
Update vllm_utils.py
danielhanchen May 11, 2025
6a2fa74
Update vllm_utils.py
danielhanchen May 11, 2025
53bc1f7
Update vllm_utils.py
danielhanchen May 11, 2025
1f39201
Update vllm_utils.py
danielhanchen May 11, 2025
8326902
Update vllm_utils.py
danielhanchen May 11, 2025
9782878
Update vllm_utils.py
danielhanchen May 11, 2025
344dcfa
Update vllm_utils.py
danielhanchen May 11, 2025
c836004
Update vllm_utils.py
danielhanchen May 11, 2025
97378a5
Update vllm_utils.py
danielhanchen May 11, 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
41 changes: 25 additions & 16 deletions unsloth_zoo/vllm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,13 @@ def patch_vllm():
# Temporary patch to disable multiprocessing for vLLM
# Allows accessing model_executor
os.environ["VLLM_ENABLE_V1_MULTIPROCESSING"] = "0"
os.environ["VLLM_LOGGING_LEVEL"] = "DEBUG"
patch_bitsandbytes_quant_state()
patch_vllm_bitsandbytes()
patch_vllm_lora_tokenizer()
patch_vllm_lora_load_tensors()
global LORA_REQUEST_ID
LORA_REQUEST_ID = 0
LORA_REQUEST_ID = 1
pass


Expand Down Expand Up @@ -519,6 +520,7 @@ def get_state_dict(prefix, kk, state_dict, proj):
quant_state_dict["model.embed_tokens.weight"] = state_dict["model.embed_tokens.weight"]

# All layers
skipped_layernorms = []
for kk in range(len(vllm_internals.model.layers)):
proj = vllm_internals.model.layers[kk].self_attn.qkv_proj
get_state_dict(f"model.layers.{kk}.self_attn.q_proj", 0, state_dict, proj)
Expand Down Expand Up @@ -547,9 +549,11 @@ def get_state_dict(prefix, kk, state_dict, proj):
vllm_name = f"vllm_internals.{vllm_name}"
try:
layernorm = eval(vllm_name).state_dict()["weight"]
state_dict[layernorm_name + ".weight"] = layernorm
except:
print(f"vllm_internals.{layernorm_name}")
layernorm_name = layernorm_name + ".weight"
state_dict[layernorm_name] = layernorm
quant_state_dict[layernorm_name] = state_dict[layernorm_name]
except Exception as e:
skipped_layernorms.append(layernorm_name.split(".")[-1])
pass
pass

Expand All @@ -569,6 +573,9 @@ def get_state_dict(prefix, kk, state_dict, proj):
quant_state_dict["lm_head.weight"] = state_dict["lm_head.weight"]
pass

if len(skipped_layernorms) != 0:
print(f"Unsloth: Just some info: will skip parsing {list(set(skipped_layernorms))}")

if not return_state_dict: state_dict = None
return state_dict, quant_state_dict
pass
Expand Down Expand Up @@ -683,9 +690,14 @@ def _override_to(self, *args, **kwargs):
except: return self
pass

skipped_layernorms = []
for kk in range(config.num_hidden_layers):
for layer_name in layer_names:
layer_name = layer_name.format(kk = kk)
if f"{layer_name}.weight" not in quant_state_dict:
skipped_layernorms.append(layer_name.split(".")[-1])
continue
pass
weight = quant_state_dict[f"{layer_name}.weight"]

if f"{layer_name}.bias" in quant_state_dict:
Expand Down Expand Up @@ -723,15 +735,8 @@ def _override_to(self, *args, **kwargs):
# Layernorms
weight = torch.nn.Parameter(weight, requires_grad = False)
layer_name = re.sub(r"\.([\d]{1,})\.", r"[\1].", layer_name)
try:
# We first must access if the layernorm / item exists
exec(f"new_model.{layer_name}")

# If it succeeds, then try will enter the below:
exec(f"new_model.{layer_name}.weight = None")
exec(f"new_model.{layer_name}.weight = weight")
except:
pass
exec(f"new_model.{layer_name}.weight = None")
exec(f"new_model.{layer_name}.weight = weight")
continue
pass

Expand Down Expand Up @@ -799,6 +804,9 @@ def _override_to(self, *args, **kwargs):
for _ in range(3):
gc.collect()
torch.cuda.empty_cache()

if len(skipped_layernorms) != 0:
print(f"Unsloth: Just some info: will skip parsing {list(set(skipped_layernorms))}")
return new_model
pass

Expand Down Expand Up @@ -1100,7 +1108,8 @@ def load_vllm(
disable_log_stats = disable_log_stats,
enable_prefix_caching = enable_prefix_caching,
# enable_chunked_prefill = True, # LoRA fails with chunked prefill as at Feb 2025
max_seq_len_to_capture = min(8192, max_seq_length + 256), # Default is 8192 for CUDAGraphs
# max_seq_len_to_capture fails for V1
# max_seq_len_to_capture = min(8192, max_seq_length + 256), # Default is 8192 for CUDAGraphs
compilation_config = compilation_config, # 0, 1, 2, 3
enforce_eager = enforce_eager,
swap_space = swap_space, # Low memory devices like Colab (13GB) default 4GB
Expand Down Expand Up @@ -1381,10 +1390,10 @@ def load_lora(model, save_directory, load_tensors = False):

# All Unsloth Zoo code licensed under LGPLv3
global LORA_REQUEST_ID
if LORA_REQUEST_ID is None: LORA_REQUEST_ID = 0
if LORA_REQUEST_ID is None: LORA_REQUEST_ID = 1

# Check if path exists
if not os.path.exists(save_directory) or LORA_REQUEST_ID == 0:
if not os.path.exists(save_directory) or LORA_REQUEST_ID == 1:
if load_tensors:
# We need to save and load the config file once!
model.peft_config["default"].save_pretrained(save_directory)
Expand Down