fix: can not find pipeline & text preprocessor
Signed-off-by: Jinzhe Pan <eigensystem1318@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user