BoxOfColors Claude Sonnet 4.6 commited on
Commit
01d72dd
·
1 Parent(s): 35c95b4

Fix HunyuanFoley xregen: register model lib sys.path in main process

Browse files

ZeroGPU workers add model library dirs to sys.path via _ensure_syspath,
but this only affects the worker subprocess. When the worker pickles its
return value (which contains hunyuanvideo_foley objects like text_feats),
_ForkingPickler.loads() in the main process fails with:
ModuleNotFoundError: No module named 'hunyuanvideo_foley'

Fix: call _ensure_syspath for all three model libraries at module level
(immediately after the function definition) so the main process has all
model paths in sys.path before it ever deserialises a worker result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -173,6 +173,16 @@ def _ensure_syspath(subdir: str) -> str:
173
  sys.path.insert(0, p)
174
  return p
175
 
 
 
 
 
 
 
 
 
 
 
176
 
177
  def _get_device_and_dtype() -> tuple:
178
  """Return (device, weight_dtype) pair used by all GPU functions.
 
173
  sys.path.insert(0, p)
174
  return p
175
 
176
+ # Ensure all model library subdirs are in sys.path for the MAIN PROCESS.
177
+ # ZeroGPU workers also call _ensure_syspath internally, but when the worker
178
+ # pickles its return value and the main process deserialises it via
179
+ # _ForkingPickler.loads(), the main process must already have these modules
180
+ # importable — otherwise ModuleNotFoundError is raised during unpickling.
181
+ _ensure_syspath("HunyuanVideo-Foley")
182
+ _ensure_syspath("MMAudio")
183
+ _ensure_syspath("TARO")
184
+ print("[startup] Model library sys.path entries registered in main process.")
185
+
186
 
187
  def _get_device_and_dtype() -> tuple:
188
  """Return (device, weight_dtype) pair used by all GPU functions.