MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / __init__

Method __init__

wan/modules/clip.py:503–525  ·  view source on GitHub ↗
(self, dtype, device, checkpoint_path, tokenizer_path)

Source from the content-addressed store, hash-verified

501class CLIPModel:
502
503 def __init__(self, dtype, device, checkpoint_path, tokenizer_path):
504 self.dtype = dtype
505 self.device = device
506 self.checkpoint_path = checkpoint_path
507 self.tokenizer_path = tokenizer_path
508
509 # init model
510 self.model, self.transforms = clip_xlm_roberta_vit_h_14(
511 pretrained=False,
512 return_transforms=True,
513 return_tokenizer=False,
514 dtype=dtype,
515 device=device)
516 self.model = self.model.eval().requires_grad_(False)
517 logging.info(f'loading {checkpoint_path}')
518 self.model.load_state_dict(
519 torch.load(checkpoint_path, map_location='cpu'))
520
521 # init tokenizer
522 self.tokenizer = HuggingfaceTokenizer(
523 name=tokenizer_path,
524 seq_len=self.model.max_text_len - 2,
525 clean='whitespace')
526
527 def visual(self, videos):
528 # preprocess

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected