(self, gemma_path: str, ltxv_path: str, max_length: int)
| 242 | OUTPUT_NODE = False |
| 243 | |
| 244 | def load_model(self, gemma_path: str, ltxv_path: str, max_length: int): |
| 245 | path = Path(folder_paths.get_full_path("text_encoders", gemma_path)) |
| 246 | model_root = path.parents[1] |
| 247 | tokenizer_path = Path(find_matching_dir(model_root, "tokenizer.model")) |
| 248 | gemma_model_path = Path(find_matching_dir(model_root, "model*.safetensors")) |
| 249 | processor_path = Path(find_matching_dir(model_root, "preprocessor_config.json")) |
| 250 | tokenizer_class = ltxv_gemma_tokenizer(tokenizer_path, max_length=max_length) |
| 251 | |
| 252 | processor = None |
| 253 | try: |
| 254 | image_processor = AutoImageProcessor.from_pretrained( |
| 255 | str(processor_path), |
| 256 | local_files_only=True, |
| 257 | ) |
| 258 | processor = Gemma3Processor( |
| 259 | image_processor=image_processor, |
| 260 | tokenizer=tokenizer_class().tokenizer, |
| 261 | ) |
| 262 | logger.info(f"Loaded processor from {model_root} - enhancement enabled") |
| 263 | except Exception as e: |
| 264 | logger.warning(f"Could not load processor from {model_root}: {e}") |
| 265 | |
| 266 | clip_dtype = torch.bfloat16 |
| 267 | ltxv_full_path = folder_paths.get_full_path("checkpoints", ltxv_path) |
| 268 | clip_target = comfy.supported_models_base.ClipTarget( |
| 269 | tokenizer=tokenizer_class, |
| 270 | clip=ltxv_gemma_clip( |
| 271 | gemma_model_path, ltxv_full_path, processor=processor, dtype=clip_dtype |
| 272 | ), |
| 273 | ) |
| 274 | |
| 275 | return (comfy.sd.CLIP(clip_target),) |
| 276 | |
| 277 | |
| 278 | _UNICODE_REPLACEMENTS = str.maketrans( |
no test coverage detected