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: offloaded native int8 denoisers release their safetensors file once pinned (LTX-2.5 holds ~23 GiB less host mapping) (#17065)
Daniel Han3c1fbf2a0cff
diff --git a/studio/backend/core/inference/diffusion_native_cache.py b/studio/backend/core/inference/diffusion_native_cache.pyindex 0d03a1e715e..6f5f40c4f4e 100644--- a/studio/backend/core/inference/diffusion_native_cache.py+++ b/studio/backend/core/inference/diffusion_native_cache.py@@ -501,6 +501,10 @@ def load(scale = scale,),)+ from .prequant_safetensors import _unviewed++ # No-copy aliases: a view's base survives offload's ``.data =`` re-point and keeps the whole file mapped.+ state = {key: _unviewed(value) for key, value in state.items()}model.load_state_dict(state, strict = True, assign = True)del stateif any(t.device.type == "meta" for t in (*model.parameters(), *model.buffers())):diff --git a/studio/backend/core/inference/diffusion_native_hosted.py b/studio/backend/core/inference/diffusion_native_hosted.pyindex e519c5a4589..d672b9c988c 100644--- a/studio/backend/core/inference/diffusion_native_hosted.py+++ b/studio/backend/core/inference/diffusion_native_hosted.py@@ -213,6 +213,10 @@ def load_native_from_hosted()state[fqn + ".weight_q"] = codesstate[fqn + ".weight_scale"] = scale.view(torch.int32)+ from .prequant_safetensors import _unviewed++ # No-copy aliases: a view's base survives offload's ``.data =`` re-point and keeps the whole file mapped.+ state = {key: _unviewed(value) for key, value in state.items()}model.load_state_dict(state, strict = True, assign = True)del stateif any(t.device.type == "meta" for t in (*model.parameters(), *model.buffers())):diff --git a/studio/backend/tests/test_video_native_hosted.py b/studio/backend/tests/test_video_native_hosted.pyindex 5732ef9cdce..1fa7b168058 100644--- a/studio/backend/tests/test_video_native_hosted.py+++ b/studio/backend/tests/test_video_native_hosted.py@@ -7,7 +7,9 @@ file, verified against its recorded fingerprint, and refused (dense build) whenefrom __future__ import annotations+import gcimport json+import osimport sysimport typesfrom pathlib import Path@@ -288,3 +290,26 @@ def test_only_an_opted_in_family_offload_int8_takes_the_hosted_file(monkeypatch)monkeypatch.setattr(V, "native_int8_act", lambda target: True)monkeypatch.setenv(NH.NATIVE_HOSTED_ENV, "0")assert V._video_native_hosted_scheme(ltx25, "int8", _target()) is None+++def _file_mapped(path) -> bool:+ real = os.path.realpath(str(path))+ with open("/proc/self/maps") as maps:+ return any(line.rstrip("\n").endswith(real) for line in maps)+++def test_offload_repoint_releases_the_hosted_file(tmp_path):+ # Group offload re-points each weight at its pinned copy; a view's base would keep the file mapped.+ path, cfg_dir, _built = _write_hosted(tmp_path)+ model = _load(path, cfg_dir)+ assert model is not None+ tensors = [*model.parameters(), *model.buffers()]+ assert all(t._base is None for t in tensors)+ if not os.path.exists("/proc/self/maps"):+ return+ assert _file_mapped(path)+ for t in tensors:+ t.data = t.data.clone()+ del t, tensors+ gc.collect()+ assert not _file_mapped(path)diff --git a/studio/backend/tests/test_video_native_prequant_cache.py b/studio/backend/tests/test_video_native_prequant_cache.pyindex e6ac8af8631..3541fb45aef 100644--- a/studio/backend/tests/test_video_native_prequant_cache.py+++ b/studio/backend/tests/test_video_native_prequant_cache.py@@ -357,3 +357,34 @@ def test_hosted_int8_is_not_the_offload_build():assert not int8_convrot_enabled(FAMILY)assert _spec()["rot_group"] == 256+++def _file_mapped(path) -> bool:+ real = os.path.realpath(str(path))+ with open("/proc/self/maps") as maps:+ return any(line.rstrip("\n").endswith(real) for line in maps)+++def test_offload_repoint_releases_the_cache_entry(base_dir):+ import gc++ fam = _family()+ spec = _spec()+ fresh = _fresh_build(base_dir, "transformer")+ assert NC.save(fresh, fam, spec, base_repo = base_dir, component = "transformer") is not None+ del fresh+ path = NC.lookup(fam, spec, base_repo = base_dir, component = "transformer")+ cached = NC.load(+ path, diffusers.WanTransformer3DModel, base_dir, component = "transformer", spec = spec+ )+ assert cached is not None+ tensors = [*cached.parameters(), *cached.buffers()]+ assert all(t._base is None for t in tensors)+ if not os.path.exists("/proc/self/maps"):+ return+ assert _file_mapped(path)+ for t in tensors:+ t.data = t.data.clone()+ del t, tensors+ gc.collect()+ assert not _file_mapped(path)