unsloth/tests/saving
Andrew Chen b508c8fe89
fix(save): unsloth_push_to_hub_gguf(save_method="lora") raises NameError (#7193)
* fix(save): unsloth_push_to_hub_gguf(save_method="lora") raises NameError

unsloth_push_to_hub_gguf reads is_main_process at save.py:3181 but never
declares it. Its twin unsloth_save_pretrained_gguf declares it (2783) and
uses it the same way (2839) -- the LoRA branch was copied between the twins,
the parameter it depends on was not. There is no module-level global, so the
name resolves as a global load and the branch raises NameError 100% of the
time.

save_pretrained_gguf(save_method="lora", push_to_hub=True) raises a
ValueError that tells users to "use .push_to_hub_gguf(save_method='lora')
instead" -- the documented escape hatch is the broken call.

Add is_main_process to the signature, positioned as in the twin, and forward
it to unsloth_save_pretrained_gguf on the merged path so the parameter is not
silently ignored there. Default stays True, so nothing changes for existing
callers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(save): preserve GGUF push compatibility

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Etherll <61019402+Etherll@users.noreply.github.com>
2026-07-17 11:55:34 +03:00
..
gpt-oss-merge Windows installer: fix DiskPart UAC mid-install, drive-root cache, and spurious unsloth.exe rename warning (#6296) 2026-06-22 03:09:08 -07:00
language_models Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
non_peft Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
text_to_speech_models Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
vision_models Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_compressed_export_schemes.py Add FP8/FP4 compressed export to save_pretrained_merged (#6706) 2026-06-30 03:40:16 -07:00
test_export_api_surface.py Add FP8/FP4 compressed export to save_pretrained_merged (#6706) 2026-06-30 03:40:16 -07:00
test_export_dispatch.py fix(save): unsloth_push_to_hub_gguf(save_method="lora") raises NameError (#7193) 2026-07-17 11:55:34 +03:00
test_fix_sentencepiece_gguf_robustness.py Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports (#6079) 2026-06-08 04:24:13 -07:00
test_gguf_export_and_inference.py Add FP8/FP4 compressed export to save_pretrained_merged (#6706) 2026-06-30 03:40:16 -07:00
test_gguf_single_pass_export.py fix: single-pass GGUF export for directly convertible outtypes in save.py (#7090) 2026-07-15 05:25:03 -07:00
test_imatrix_export.py Add FP8/FP4 compressed export to save_pretrained_merged (#6706) 2026-06-30 03:40:16 -07:00
test_is_gpt_oss_detection.py Reduce comments across recent fixes (#6776) 2026-06-30 23:13:36 -07:00
test_llm_compressor_install_pin.py Pin llm-compressor auto-install to a vetted version range (#6778) 2026-07-01 04:48:38 -07:00
test_normalize_tied_weights_keys.py Fix save crash for legacy list-form _tied_weights_keys (NemotronH) (#6540) 2026-06-22 02:11:46 -07:00
test_patch_saving_none_tokenizer.py Fix tokenizer save gemma (#5115) 2026-04-22 09:03:20 -07:00
test_preserve_tokenizer_eos_token.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_prewarm_base_model_hub_cache.py Fix repeated base model downloads across checkpoint exports (#6896) 2026-07-06 23:38:29 -07:00
test_quant_method_none_normalization.py fix: map None quant method to q8_0 before lowercasing in GGUF export (#6889) 2026-07-06 07:11:49 -07:00
test_qwen3_5_vlm_full_finetune_key_remap.py Merge qwen35_export CI fixes 2026-06-08 22:02:05 +05:30
test_save_shell_injection.py Add FP8/FP4 compressed export to save_pretrained_merged (#6706) 2026-06-30 03:40:16 -07:00
test_save_subprocess_utf8_encoding.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_torchao_remote_code_consent.py Fix export-time trust_remote_code bypass in FP8/INT8/GGUF-LoRA export (#6869) 2026-07-05 05:16:39 -07:00
test_unsloth_save.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00