mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-29 07:05:14 -07:00
fix(offline): remove process-global offline guard from Qwen3 LLM loads (#924)
force_offline_if_cached flips HF_HUB_OFFLINE (env + huggingface_hub constant + transformers._is_offline_mode) process-wide for the duration of a cached LLM load, silently switching every concurrent model download/load on other threads to offline mode. With default capture settings (whisper-turbo STT + Qwen3 refinement + auto_refine) a first run downloads several models concurrently, and a poisoned fetch surfaces as "Can't load feature extractor..." (whisper) or "Unrecognized model ... model_type" (Qwen3) rather than anything mentioning offline mode. These are the last two call sites of the guard — the same pattern was deliberately removed app-wide in #524/#530 after identical failures, and the 0.5.0 LLM backend reintroduced it. LLM loads now run with the process's default HF_HUB_OFFLINE state, matching every other backend (issue #462 precedent). Fixes #841 Claude-Session: https://claude.ai/code/session_011iwL9AyeAWgz2jpgcHxJpC Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
committed by
Jamie Pine
co-authored by
Claude Fable 5
parent
e001439c06
commit
3f4631c865
@@ -20,7 +20,6 @@ from .base import (
|
|||||||
model_load_progress,
|
model_load_progress,
|
||||||
)
|
)
|
||||||
from ..services.mlx_thread import run_on_mlx_thread, clear_mlx_cache
|
from ..services.mlx_thread import run_on_mlx_thread, clear_mlx_cache
|
||||||
from ..utils.hf_offline_patch import force_offline_if_cached
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -104,15 +103,19 @@ class PyTorchQwenLLMBackend:
|
|||||||
|
|
||||||
with model_load_progress(progress_model_name, is_cached):
|
with model_load_progress(progress_model_name, is_cached):
|
||||||
logger.info("Loading Qwen3 %s on %s...", model_size, self.device)
|
logger.info("Loading Qwen3 %s on %s...", model_size, self.device)
|
||||||
with force_offline_if_cached(is_cached, progress_model_name):
|
# Loads run with the process's default HF_HUB_OFFLINE state.
|
||||||
self.tokenizer = AutoTokenizer.from_pretrained(repo)
|
# Forcing offline for cached models flips process-global state
|
||||||
dtype = torch.float16 if self.device in ("cuda", "mps") else torch.float32
|
# and silently switches every concurrent download/load on other
|
||||||
self.model = AutoModelForCausalLM.from_pretrained(
|
# threads to offline mode (issue #841) — the same regression
|
||||||
repo,
|
# removed app-wide in #524/#530.
|
||||||
dtype=dtype,
|
self.tokenizer = AutoTokenizer.from_pretrained(repo)
|
||||||
)
|
dtype = torch.float16 if self.device in ("cuda", "mps") else torch.float32
|
||||||
self.model.to(self.device)
|
self.model = AutoModelForCausalLM.from_pretrained(
|
||||||
self.model.eval()
|
repo,
|
||||||
|
dtype=dtype,
|
||||||
|
)
|
||||||
|
self.model.to(self.device)
|
||||||
|
self.model.eval()
|
||||||
|
|
||||||
self._current_model_size = model_size
|
self._current_model_size = model_size
|
||||||
self.model_size = model_size
|
self.model_size = model_size
|
||||||
@@ -235,8 +238,8 @@ class MLXQwenLLMBackend:
|
|||||||
|
|
||||||
with model_load_progress(progress_model_name, is_cached):
|
with model_load_progress(progress_model_name, is_cached):
|
||||||
logger.info("Loading Qwen3 %s via MLX...", model_size)
|
logger.info("Loading Qwen3 %s via MLX...", model_size)
|
||||||
with force_offline_if_cached(is_cached, progress_model_name):
|
# See the PyTorch loader comment — no offline forcing (issue #841).
|
||||||
loaded = mlx_load(repo)
|
loaded = mlx_load(repo)
|
||||||
|
|
||||||
# mlx_lm.load returns (model, tokenizer) by default and
|
# mlx_lm.load returns (model, tokenizer) by default and
|
||||||
# (model, tokenizer, config) when return_config=True.
|
# (model, tokenizer, config) when return_config=True.
|
||||||
|
|||||||
Reference in New Issue
Block a user