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
Studio: recognise model.safetensors-N-of-M shards for training resume (#15405) (#15408)
Indrajit swain4aeeb08682b1
diff --git a/studio/backend/core/training/provenance.py b/studio/backend/core/training/provenance.pyindex 485d8cb172f..7161970eb06 100644--- a/studio/backend/core/training/provenance.py+++ b/studio/backend/core/training/provenance.py@@ -24,7 +24,10 @@ _MODEL_LOAD_PREQUANTIZED_4BIT = "prequantized_4bit"_MODEL_LOAD_RUNTIME_4BIT = "runtime_4bit"_PREQUANTIZED_MODE_RE = re.compile(r"prequantized_(?:1[0-6]|[1-9])(?:_(?:1[0-6]|[1-9])){0,7}bit")_REASON_RE = re.compile(r"[a-z0-9][a-z0-9_-]{0,63}")+# unsloth/Qwen3.5-* shards are named ``model.safetensors-00001-of-00001.safetensors`` (#15405)._MODEL_WEIGHT_RE = re.compile(+ r"(?:"+ r"model\.safetensors-\d+-of-\d+(?:\.safetensors)?|"r"(?:"r"model(?:-\d+-of-\d+)?|"r"pytorch_model(?:-\d+-of-\d+)?|"@@ -32,7 +35,8 @@ _MODEL_WEIGHT_RE = re.compile(r"consolidated(?:[._-]\d+)?|"r"mlx_model(?:-\d+-of-\d+)?|"r"weights"- r")\.(?:safetensors|bin|pt|pth|ckpt|npz)$",+ r")\.(?:safetensors|bin|pt|pth|ckpt|npz)"+ r")$",re.IGNORECASE,)_DATASET_DATA_SUFFIXES = (diff --git a/studio/backend/tests/test_training_provenance.py b/studio/backend/tests/test_training_provenance.pyindex 326aa8298cf..ab57f9b319a 100644--- a/studio/backend/tests/test_training_provenance.py+++ b/studio/backend/tests/test_training_provenance.py@@ -14,6 +14,8 @@ import pytestfrom core.training.provenance import (ExactResumeResourcesUnavailable,RESOURCE_PROVENANCE_KEY,+ _MODEL_WEIGHT_RE,+ _snapshot_has_model_weights,attest_loaded_dataset,build_worker_provenance_event,effective_training_load_in_4bit,@@ -719,6 +721,24 @@ def test_config_only_snapshot_cannot_attest_model_weights(tmp_path):)+ "filename",+ [+ "model.safetensors-00001-of-00001.safetensors",+ "model.safetensors-00001-of-00001",+ "model-00000-of-00001.safetensors",+ "model.safetensors",+ ],+)+def test_extension_before_shard_weight_names_count_as_model_weights(tmp_path, filename):+ """Qwen3.5 Hub shards use model.safetensors-00001-of-00001.safetensors (#15405)."""+ assert _MODEL_WEIGHT_RE.fullmatch(filename)+ snapshot = _model_snapshot(tmp_path, "unsloth/Qwen3.5-2B", "qwen35", weights = False)+ (snapshot / filename).write_bytes(b"weights")+ assert _snapshot_has_model_weights(snapshot)+ assert exact_model_snapshot_path(str(snapshot), "unsloth/Qwen3.5-2B") == str(snapshot.resolve())++def test_exact_model_snapshot_accepts_own_blob_symlink(tmp_path):snapshot = _model_snapshot(tmp_path,