Skip to content

Commit 3406d9f

Browse files
committed
fix(mlx): keep the PEFT export path free of torch imports
Exporting an embedding LoRA without base_weights_source logged through the shared logger, which resolves on first use by importing a module that imports torch. saving_utils is otherwise importable and usable without torch, so that export raised ModuleNotFoundError on a torch-free Apple install. Drop the informational log; the behaviour it described is unchanged.
1 parent 0a74fe3 commit 3406d9f

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

unsloth_zoo/saving_utils.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6475,13 +6475,10 @@ def _unnest_map(mapping, what):
64756475
"source does not match the adapter's base model."
64766476
)
64776477
out[f"{_PEFT_PREFIX}{_p}.base_layer.weight"] = _w
6478-
elif _unsourced_emb:
6479-
logger.info(
6480-
"Unsloth MLX: exporting embedding LoRA for "
6481-
f"{_unsourced_emb} without base embedding weights (no "
6482-
"base_weights_source); PEFT loads such adapters cleanly and "
6483-
"takes the embeddings from the base model."
6484-
)
6478+
# An embedding adapter exported without base_weights_source simply omits
6479+
# those weights; peft resolves them from the base model. Nothing is logged
6480+
# here on purpose -- this module stays importable and usable without torch,
6481+
# and the shared logger pulls in a torch-importing module on first use.
64856482
# Same stage-then-atomic-rename destination contract as
64866483
# convert_peft_dir_to_mlx; see the note there.
64876484
dst = os.fspath(dst)

0 commit comments

Comments
 (0)