Skip colorspace detection when using offload strategies

Colorspace detection requires extra memory that may not be available
when using offload strategies (sequential, balanced, auto_map, group).
Now skips detection and defaults to RGB for:
- Any offload strategy other than 'none' or 'model'
- Systems with <12GB available RAM

Users can still manually set colorspace or use --swap_bgr if needed.
parent 5f5c7ac4
...@@ -1367,6 +1367,28 @@ def get_model_colorspace(pipe, model_name, m_info, args): ...@@ -1367,6 +1367,28 @@ def get_model_colorspace(pipe, model_name, m_info, args):
if model_name in MODELS and "colorspace" in MODELS[model_name]: if model_name in MODELS and "colorspace" in MODELS[model_name]:
return MODELS[model_name]["colorspace"] return MODELS[model_name]["colorspace"]
# Skip detection if using offload strategies (memory-constrained)
# Colorspace detection requires extra memory that may not be available
offload_strategy = getattr(args, 'offload_strategy', 'model')
if offload_strategy not in ['none', 'model']:
print(f" 📊 Colorspace: Skipping detection (offload_strategy={offload_strategy})")
print(f" Defaulting to RGB (use --swap_bgr if colors look wrong)")
# Save RGB as default to avoid repeated attempts
if model_name in MODELS:
MODELS[model_name]["colorspace"] = "RGB"
save_models_config(MODELS)
return "RGB"
# Also skip if low system RAM
available_ram_gb = get_available_ram_gb()
if available_ram_gb < 12.0: # Need ample RAM for detection
print(f" 📊 Colorspace: Skipping detection (low RAM: {available_ram_gb:.1f}GB)")
print(f" Defaulting to RGB (use --swap_bgr if colors look wrong)")
if model_name in MODELS:
MODELS[model_name]["colorspace"] = "RGB"
save_models_config(MODELS)
return "RGB"
# Detect and save # Detect and save
return detect_model_colorspace(pipe, model_name, m_info, args) return detect_model_colorspace(pipe, model_name, m_info, args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment