From 8f7710a77c4736911aaee346a7192fdc7c576190 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:12:02 +0200 Subject: [PATCH] Avoid trying to create preprocessor with encoder only model --- hyvideo/text_encoder/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hyvideo/text_encoder/__init__.py b/hyvideo/text_encoder/__init__.py index 27d4839..f877593 100644 --- a/hyvideo/text_encoder/__init__.py +++ b/hyvideo/text_encoder/__init__.py @@ -151,6 +151,7 @@ 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" @@ -158,7 +159,8 @@ def __init__( 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}")