16 lines
1.1 KiB
Python
16 lines
1.1 KiB
Python
"""Strict routing for the Deck LTX workflow's text encoder."""
|
|
import torch
|
|
import comfy.sd
|
|
import folder_paths
|
|
class DeckLTXTextEncoderLoader:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):return {'required':{'clip_name':(folder_paths.get_filename_list('text_encoders'),)}}
|
|
RETURN_TYPES=('CLIP',);FUNCTION='load';CATEGORY='Deck / LTX'
|
|
def load(self,clip_name):
|
|
if torch.cuda.device_count()!=2:raise RuntimeError('Deck requires its reserved 5080 and 3060.')
|
|
clip=comfy.sd.load_clip(ckpt_paths=[folder_paths.get_full_path_or_raise('text_encoders',clip_name)],embedding_directory=folder_paths.get_folder_paths('embeddings'),clip_type=comfy.sd.CLIPType.LTXV,model_options={'load_device':torch.device('cuda:1'),'offload_device':torch.device('cpu'),'initial_device':torch.device('cpu')})
|
|
if clip.patcher.load_device!=torch.device('cuda:1'):raise RuntimeError('LTX text encoder GPU assignment failed.')
|
|
return (clip,)
|
|
NODE_CLASS_MAPPINGS={'DeckLTXTextEncoderLoader':DeckLTXTextEncoderLoader}
|
|
NODE_DISPLAY_NAME_MAPPINGS={'DeckLTXTextEncoderLoader':'Deck · LTX Textencoder auf RTX 3060'}
|