Skip to content

Commit

Permalink
Avoid trying to create preprocessor with encoder only model
Browse files Browse the repository at this point in the history
  • Loading branch information
kijai committed Dec 16, 2024
1 parent f169e83 commit 8f7710a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hyvideo/text_encoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,16 @@ def __init__(
self.reproduce = reproduce
self.logger = logger
self.is_fp8 = False
self.processor = None

if "t5" in text_encoder_type:
self.output_key = output_key or "last_hidden_state"
elif "clip" in text_encoder_type:
self.output_key = output_key or "pooler_output"
elif "llm" in text_encoder_type or "glm" in text_encoder_type or "vlm" in text_encoder_type:
self.output_key = output_key or "last_hidden_state"
self.processor = AutoProcessor.from_pretrained(text_encoder_path, device=device)
if "glm" in text_encoder_type or "vlm" in text_encoder_type:
self.processor = AutoProcessor.from_pretrained(text_encoder_path, device=device)
else:
raise ValueError(f"Unsupported text encoder type: {text_encoder_type}")

Expand Down

0 comments on commit 8f7710a

Please sign in to comment.