From 6ae4292ab6047312c51dfafd946305c191372d4d Mon Sep 17 00:00:00 2001 From: Jinzhe Pan Date: Fri, 13 Feb 2026 07:37:40 +0000 Subject: [PATCH] fix: can not find pipeline & text preprocessor Signed-off-by: Jinzhe Pan --- fastvideo/configs/pipelines/hunyuangamecraft.py | 15 +++++++++++---- .../basic/gamecraft/{__init_.py => __init__.py} | 0 fastvideo/pipelines/pipeline_registry.py | 2 +- fastvideo/pipelines/stages/gamecraft_denoising.py | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) rename fastvideo/pipelines/basic/gamecraft/{__init_.py => __init__.py} (100%) diff --git a/fastvideo/configs/pipelines/hunyuangamecraft.py b/fastvideo/configs/pipelines/hunyuangamecraft.py index 24fc2f7cd..a4a3647e3 100644 --- a/fastvideo/configs/pipelines/hunyuangamecraft.py +++ b/fastvideo/configs/pipelines/hunyuangamecraft.py @@ -57,10 +57,17 @@ def llama_preprocess_text(prompt: str) -> str: def llama_postprocess_text(outputs: BaseEncoderOutput) -> torch.Tensor: """Extract hidden states from LLaMA output, skipping instruction tokens.""" hidden_state_skip_layer = 2 - assert outputs.hidden_states is not None - hidden_states: tuple[torch.Tensor, ...] = outputs.hidden_states - last_hidden_state: torch.Tensor = hidden_states[-(hidden_state_skip_layer + - 1)] + hidden_states = outputs.hidden_states + if hidden_states is not None and len(hidden_states) > hidden_state_skip_layer: + last_hidden_state: torch.Tensor = hidden_states[ + -(hidden_state_skip_layer + 1)] + elif outputs.last_hidden_state is not None: + # Fallback for encoder outputs without hidden_states. + last_hidden_state = outputs.last_hidden_state + else: + raise ValueError( + "LLaMA encoder output must contain hidden_states or last_hidden_state." + ) crop_start = prompt_template_video.get("crop_start", -1) last_hidden_state = last_hidden_state[:, crop_start:] return last_hidden_state diff --git a/fastvideo/pipelines/basic/gamecraft/__init_.py b/fastvideo/pipelines/basic/gamecraft/__init__.py similarity index 100% rename from fastvideo/pipelines/basic/gamecraft/__init_.py rename to fastvideo/pipelines/basic/gamecraft/__init__.py diff --git a/fastvideo/pipelines/pipeline_registry.py b/fastvideo/pipelines/pipeline_registry.py index b4b9c610a..b680a30ae 100644 --- a/fastvideo/pipelines/pipeline_registry.py +++ b/fastvideo/pipelines/pipeline_registry.py @@ -174,7 +174,7 @@ def _import_pipeline_classes_cached( pipeline_module = importlib.import_module(module_name) if not hasattr(pipeline_module, "EntryClass"): continue - entry_cls = pipeline_module.EntryClass + entry_cls = getattr(pipeline_module, "EntryClass") entry_cls_list = ([ entry_cls ] if not isinstance(entry_cls, list) else entry_cls) diff --git a/fastvideo/pipelines/stages/gamecraft_denoising.py b/fastvideo/pipelines/stages/gamecraft_denoising.py index 8e5553b6c..90a6363e2 100644 --- a/fastvideo/pipelines/stages/gamecraft_denoising.py +++ b/fastvideo/pipelines/stages/gamecraft_denoising.py @@ -174,11 +174,11 @@ class GameCraftDenoisingStage(DenoisingStage): dtype=target_dtype) # Debug logging - logger.info("[GameCraft DEBUG] latents shape: %s, min/max: %.4f/%.4f", + logger.debug("[GameCraft DEBUG] latents shape: %s, min/max: %.4f/%.4f", latents.shape, latents.min(), latents.max()) - logger.info("[GameCraft DEBUG] camera_states: %s", + logger.debug("[GameCraft DEBUG] camera_states: %s", camera_states.shape if camera_states is not None else None) - logger.info("[GameCraft DEBUG] prompt_embeds[0] shape: %s", + logger.debug("[GameCraft DEBUG] prompt_embeds[0] shape: %s", prompt_embeds[0].shape) # Initialize lists for trajectory