MCPcopy Create free account
hub / github.com/OpenMeshLab/MeshXL / forward

Method forward

models/x_mesh_xl/get_model.py:41–57  ·  view source on GitHub ↗
(self, input_ids, attention_mask)

Source from the content-addressed store, hash-verified

39 return text_embeds # bs x ntoken x ch
40
41 def forward(self, input_ids, attention_mask):
42 net_device = next(self.parameters()).device
43 text_embeds = self.encode_text(input_ids=input_ids, attention_mask=attention_mask)
44 query_embeds = self.query_embeds(
45 repeat(
46 torch.arange(0, self.n_learnable_queries, dtype=torch.int64).to(net_device),
47 'src -> bs src',
48 bs = text_embeds.shape[0]
49 )
50 )
51 query_outputs = self.qformer(
52 query_embeds=query_embeds,
53 encoder_hidden_states=text_embeds,
54 encoder_attention_mask=attention_mask
55 )
56 query_outputs = query_outputs[0][:, : self.n_learnable_queries, :]
57 return self.out_project(query_outputs)
58
59
60

Callers

nothing calls this directly

Calls 1

encode_textMethod · 0.95

Tested by

no test coverage detected