MCPcopy Create free account
hub / github.com/CHENGY12/PLOT / forward

Method forward

plot-adapter/main.py:67–78  ·  view source on GitHub ↗
(self, prompts, tokenized_prompts)

Source from the content-addressed store, hash-verified

65 self.dtype = clip_model.dtype
66
67 def forward(self, prompts, tokenized_prompts):
68
69 x = prompts + self.positional_embedding.type(self.dtype)
70
71 x = x.permute(1, 0, 2) # NLD -> LND
72 x = self.transformer(x)
73 x = x.permute(1, 0, 2) # LND -> NLD
74 x = self.ln_final(x).type(self.dtype)
75
76 x = x[torch.arange(x.shape[0]), tokenized_prompts.argmax(dim=-1)] @ self.text_projection
77
78 return x
79
80
81class PromptLearner(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected