MCPcopy Create free account
hub / github.com/NVlabs/LongLive / forward

Method forward

utils/wan_5b_wrapper.py:43–55  ·  view source on GitHub ↗
(self, text_prompts: List[str])

Source from the content-addressed store, hash-verified

41 return torch.cuda.current_device()
42
43 def forward(self, text_prompts: List[str]) -> dict:
44 ids, mask = self.tokenizer(
45 text_prompts, return_mask=True, add_special_tokens=True)
46 ids = ids.to(self.device)
47 mask = mask.to(self.device)
48 seq_lens = mask.gt(0).sum(dim=1).long()
49 context = self.text_encoder(ids, mask)
50 for u, v in zip(context, seq_lens):
51 u[v:] = 0.0 # set padding to 0.0
52
53 return {
54 "prompt_embeds": context
55 }
56
57
58class WanVAEWrapper(torch.nn.Module):

Callers

nothing calls this directly

Calls 1

toMethod · 0.80

Tested by

no test coverage detected