Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Only remove folder in sentenpiece check if it was created (#1121)
Giulia Baldini592191b0611d
diff --git a/unsloth/save.py b/unsloth/save.pyindex 3ba62b46885..3e82a5bcdde 100644--- a/unsloth/save.py+++ b/unsloth/save.py@@ -101,14 +101,17 @@ def check_if_sentencepiece_model(model, temporary_location = "_unsloth_sentenceptemp_tokenizer = model._saved_temp_tokenizersentencepiece_model = Falsefile_location = os.path.join(temporary_location, temp_tokenizer.name_or_path)+ created_folder = Falseif not os.path.exists(file_location):+ created_folder = Trueos.makedirs(file_location)passtemp_tokenizer.save_pretrained(file_location)if os.path.isfile(f"{file_location}/tokenizer.model"):sentencepiece_model = Truepass- shutil.rmtree(file_location, ignore_errors = True)+ if created_folder:+ shutil.rmtree(file_location, ignore_errors = True)return sentencepiece_modelpass