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: build the video backend off the event loop in /video/status (#16792)
Daniel Hanc4a3025f4838
diff --git a/studio/backend/routes/video.py b/studio/backend/routes/video.pyindex d604d69681d..fdc17a2b1c0 100644--- a/studio/backend/routes/video.py+++ b/studio/backend/routes/video.py@@ -101,6 +101,11 @@ def _training_is_active() -> bool:return _images_training_is_active()+def _video_backend():+ from core.inference.video import get_video_backend+ return get_video_backend()++def _derived_h3_task(gguf_filename: Optional[str], kind: str) -> Optional[str]:"""The MiniMax-H3 partition a GGUF load resolves to from its filename, else None."""if kind != "gguf" or not gguf_filename:@@ -930,12 +935,12 @@ async def video_status():if account_access.resident_hidden("video"):return account_access.hidden_resident_response()- from core.inference.video import get_video_backendfrom hub.utils.host_paths import redact_host_pathsfrom core.inference import media_load_ids- backend = get_video_backend()+ # Polled on page mount, so usually the first import of the video stack: keep it off the loop.+ backend = await asyncio.to_thread(_video_backend)# With the load id of the same state, so an unload can name exactly what this answer shows.status_dict, load_id, resident_load_id = await asyncio.to_thread(media_load_ids.snapshot_ids, "video", backend, backend.statusdiff --git a/studio/backend/tests/test_video_routes.py b/studio/backend/tests/test_video_routes.pyindex b7aab0cabb6..d536b50cf5a 100644--- a/studio/backend/tests/test_video_routes.py+++ b/studio/backend/tests/test_video_routes.py@@ -1972,3 +1972,23 @@ def test_the_unload_answers_are_declared_in_the_schema(token_client):named = client.post("/api/inference/video/unload", json = {"expected_load_id": "t2"}).json()assert set(named) == set(plain) | {"unloaded", "outcome"}assert (named["unloaded"], named["outcome"]) == (True, "unloaded")+++def test_status_builds_the_backend_off_the_event_loop(client, monkeypatch):+ import asyncio++ on_loop = []+ real = video_module.get_video_backend++ def backend():+ try:+ asyncio.get_running_loop()+ on_loop.append(True)+ except RuntimeError:+ on_loop.append(False)+ return real()++ monkeypatch.setattr(video_module, "get_video_backend", backend)+ body = client.get("/api/inference/video/status").json()+ assert body["loaded"] is False+ assert on_loop == [False]