feat: update InferenceConfigBuilder to conditionally set use_31_block based on model path; clean up whitespace in LightX2VConfigCombinerV2 and LightX2VModularInferenceV2 for improved readability
This commit is contained in:
+2
-1
@@ -24,7 +24,6 @@ from .file_handlers import (
|
||||
AudioFileHandler,
|
||||
ComfyUIFileResolver,
|
||||
MaskFileHandler,
|
||||
TempFileManager,
|
||||
)
|
||||
from .model_utils import get_lora_full_path, get_model_full_path
|
||||
|
||||
@@ -162,6 +161,8 @@ class InferenceConfigBuilder:
|
||||
if "seko" in config.model_cls:
|
||||
config.video_length = optional_params.get("segment_length", 81)
|
||||
config.use_31_block = False
|
||||
if "2.5" in config.model_path:
|
||||
config.use_31_block = True
|
||||
if "prev_frame_length" in optional_params:
|
||||
config.prev_frame_length = optional_params["prev_frame_length"]
|
||||
|
||||
|
||||
+1
-2
@@ -299,13 +299,11 @@ class TempFileManager:
|
||||
if delete:
|
||||
self.cleanup_dir(temp_dir)
|
||||
|
||||
|
||||
def create_temp_dir(self, suffix: str = "", prefix: str = "lightx2v_") -> str:
|
||||
temp_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix)
|
||||
self.temp_dirs.append(temp_dir)
|
||||
return temp_dir
|
||||
|
||||
|
||||
def cleanup_dir(self, path: str):
|
||||
if path in self.temp_dirs:
|
||||
self.temp_dirs.remove(path)
|
||||
@@ -313,6 +311,7 @@ class TempFileManager:
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
import shutil
|
||||
|
||||
shutil.rmtree(path)
|
||||
logging.debug(f"Cleaned up temp directory: {path}")
|
||||
except Exception as e:
|
||||
|
||||
@@ -1132,7 +1132,6 @@ class LightX2VConfigCombinerV2:
|
||||
json.dump({"talk_objects": processed_talk_objects}, f)
|
||||
config.audio_path = temp_dir
|
||||
logging.info(f"Processed {len(processed_talk_objects)} talk objects")
|
||||
|
||||
|
||||
logging.info("lightx2v prepared config: " + json.dumps(config, indent=2, ensure_ascii=False))
|
||||
|
||||
@@ -1192,7 +1191,7 @@ class LightX2VModularInferenceV2:
|
||||
del self.__class__._current_runner
|
||||
torch.cuda.empty_cache()
|
||||
gc.collect()
|
||||
formatted_config =set_config(config)
|
||||
formatted_config = set_config(config)
|
||||
self.__class__._current_runner = init_runner(formatted_config)
|
||||
self.__class__._current_config_hash = config_hash
|
||||
|
||||
@@ -1213,7 +1212,7 @@ class LightX2VModularInferenceV2:
|
||||
current_runner.set_config(config)
|
||||
|
||||
result_dict = current_runner.run_pipeline(input_info)
|
||||
|
||||
|
||||
images = result_dict.get("video", None)
|
||||
audio = result_dict.get("audio", None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user