unsloth/unsloth
Vineeth Sai Varikuntla 274f5ff569
Remove the no-op rmtree guard around the GGUF save (#7479)
* Remove the no-op rmtree guard around the GGUF save

patch_unsloth_gguf_save saves shutil.rmtree and restores it, but never
replaces it, so the context manager does nothing. Its comment claims it
prevents deletion of the directory save_pretrained just created.

It reads as a copy of the patch_unsloth_save sibling above it, minus the one
line that does the work. Completing it is not the right fix though: the GGUF
call forces push_to_hub=False and the merge cleanup that would remove the save
directory is gated on push_to_hub=True, so nothing on this path calls rmtree.
That was verified on a real LoRA-backed q8_0 export with every rmtree call
logged, in the discussion on #7149.

Drop the dead context manager rather than leave code that looks like a guard
and is not. Behaviour is unchanged; the following step comments are renumbered
to stay contiguous.

* Note why no rmtree guard is needed at the GGUF call site

---------

Co-authored-by: danielhanchen <michaelhan2050@gmail.com>
2026-07-27 03:26:46 -07:00
..
dataprep fix(dataprep): don't emit a degenerate chunk for empty text (#7183) 2026-07-23 00:56:51 -07:00
kernels Propagate fp8 block_size before the early return in get_lora_parameters_bias (#7189) 2026-07-17 16:30:45 -07:00
models Remove the no-op rmtree guard around the GGUF save (#7479) 2026-07-27 03:26:46 -07:00
optimizers Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
registry fix(registry): don't register deepseek models at import time (#7227) 2026-07-19 03:37:23 -07:00
utils Experimental: correct varlen sample packing for hybrid linear-attention models (#7249) 2026-07-20 00:57:02 -07:00
__init__.py fix(mlx): relax context-store timeout by default (#7141) 2026-07-17 17:13:19 -03:00
_auto_install.py Upgrade setuptools and wheel in the auto-install command (#6282) 2026-06-13 03:59:15 -07:00
_compressed_quantize.py Fix export-time trust_remote_code bypass in FP8/INT8/GGUF-LoRA export (#6869) 2026-07-05 05:16:39 -07:00
_gpu_init.py Silence torch._check_is_size FutureWarning and shim it if torch removes it (#7023) 2026-07-09 02:26:36 -07:00
chat_templates.py fix(chat_templates): bind loop_messages when default_system_message is None (#7199) 2026-07-19 06:33:48 -07:00
device_type.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
import_fixes.py fix: pin torchcodec for torch 2.10 and warn on ABI mismatch (#7299) 2026-07-23 19:12:52 -07:00
ollama_template_mappers.py Re-apply #4939: updated models template mappers (#4950) 2026-04-15 07:52:12 -07:00
save.py studio: shard export checkpoint loads across all visible GPUs (#7215) 2026-07-26 04:16:36 -07:00
tokenizer_utils.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
trainer.py Experimental: correct varlen sample packing for hybrid linear-attention models (#7249) 2026-07-20 00:57:02 -07:00