@@ -148,13 +148,22 @@ def get_pipeline(use_fp8: bool = True):
148148 task = "i2i" ,
149149 )
150150
151- # Explicitly set component paths (LightX2V may not derive them correctly)
152- _pipeline .text_encoder_path = str (MODEL_PATH / "text_encoder" )
153- _pipeline .tokenizer_path = str (MODEL_PATH / "tokenizer" )
154- _pipeline .vae_path = str (MODEL_PATH / "vae" )
155- _pipeline .transformer_path = str (MODEL_PATH / "transformer" )
156- _pipeline .processor_path = str (MODEL_PATH / "processor" )
157- log (f"Set explicit paths: text_encoder={ _pipeline .text_encoder_path } " )
151+ # Explicitly set all component paths that LightX2V needs
152+ model_path_str = str (MODEL_PATH )
153+ _pipeline .text_encoder_path = f"{ model_path_str } /text_encoder"
154+ _pipeline .tokenizer_path = f"{ model_path_str } /tokenizer"
155+ _pipeline .vae_path = f"{ model_path_str } /vae"
156+ _pipeline .transformer_path = f"{ model_path_str } /transformer"
157+ _pipeline .processor_path = f"{ model_path_str } /processor"
158+
159+ # Also set on config if it exists
160+ if hasattr (_pipeline , 'config' ) and _pipeline .config :
161+ _pipeline .config .text_encoder_path = _pipeline .text_encoder_path
162+ _pipeline .config .tokenizer_path = _pipeline .tokenizer_path
163+ _pipeline .config .vae_path = _pipeline .vae_path
164+ _pipeline .config .model_path = model_path_str
165+
166+ log (f"Set paths: model={ model_path_str } , text_encoder={ _pipeline .text_encoder_path } " )
158167
159168 if use_fp8 :
160169 # Enable FP8 quantization for lower VRAM usage
@@ -302,9 +311,35 @@ def handle_edit(job_input: dict, job_id: str, work_dir: Path) -> dict:
302311
303312 log (f"Attention mode: { attn_mode } " )
304313
305- # Configure generator
314+ # Create runtime config with explicit paths
315+ import json
316+ config_path = work_dir / "lightx2v_config.json"
317+ runtime_config = {
318+ "model_path" : str (MODEL_PATH ),
319+ "text_encoder_path" : str (MODEL_PATH / "text_encoder" ),
320+ "tokenizer_path" : str (MODEL_PATH / "tokenizer" ),
321+ "vae_path" : str (MODEL_PATH / "vae" ),
322+ "transformer_path" : str (MODEL_PATH / "transformer" ),
323+ "processor_path" : str (MODEL_PATH / "processor" ),
324+ "vae_scale_factor" : 8 ,
325+ "infer_steps" : num_inference_steps ,
326+ "transformer_in_channels" : 64 ,
327+ "num_layers" : 60 ,
328+ "attention_out_dim" : 3072 ,
329+ "attention_dim_head" : 128 ,
330+ "attn_type" : attn_mode ,
331+ "enable_cfg" : True ,
332+ "sample_guide_scale" : guidance_scale ,
333+ "_auto_resize" : auto_resize ,
334+ }
335+ with open (config_path , "w" ) as f :
336+ json .dump (runtime_config , f )
337+ log (f"Created runtime config: { config_path } " )
338+
339+ # Configure generator with explicit config
306340 log (f"Configuring generator: steps={ num_inference_steps } , guidance={ guidance_scale } " )
307341 pipe .create_generator (
342+ config_json = str (config_path ),
308343 attn_mode = attn_mode ,
309344 auto_resize = auto_resize ,
310345 infer_steps = num_inference_steps ,
0 commit comments