Skip to content

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.

Studio int8 GEMM: read and write the tile race cache as UTF-8 (#17044)

Daniel Han37df025351f4
diff --git a/studio/backend/core/inference/diffusion_int8_gemm.py b/studio/backend/core/inference/diffusion_int8_gemm.py
index 3e26248e44e..4e6ad042687 100644
--- a/studio/backend/core/inference/diffusion_int8_gemm.py
+++ b/studio/backend/core/inference/diffusion_int8_gemm.py
@@ -802,7 +802,9 @@ def _race_cache_load(key: Optional[str]) -> Optional[tuple]:
try:
import json
tile = (
- json.loads(path.read_text()).get(key) if path is not None and path.is_file() else None
+ json.loads(path.read_text(encoding = "utf-8")).get(key)
+ if path is not None and path.is_file()
+ else None
)
except Exception: # noqa: BLE001 - unreadable or corrupt: a miss
return None
@@ -818,7 +820,7 @@ def _race_cache_store(key: Optional[str], tile: tuple) -> None:
import json
try:
- table = json.loads(path.read_text()) if path.is_file() else {}
+ table = json.loads(path.read_text(encoding = "utf-8")) if path.is_file() else {}
except Exception: # noqa: BLE001
table = {}
table = {k: v for k, v in table.items() if k != key and isinstance(v, list)}
@@ -826,7 +828,7 @@ def _race_cache_store(key: Optional[str], tile: tuple) -> None:
table[key] = list(tile)
path.parent.mkdir(parents = True, exist_ok = True)
tmp = path.with_name(f"{path.name}.{os.getpid()}.tmp")
- tmp.write_text(json.dumps(table))
+ tmp.write_text(json.dumps(table), encoding = "utf-8")
os.replace(tmp, path)
except Exception: # noqa: BLE001 - persistence is best-effort
pass