MCPcopy
hub / github.com/ModelTC/LightLLM / forward

Method forward

lightllm/models/vit/model.py:163–170  ·  view source on GitHub ↗
(self, pixel_values)

Source from the content-addressed store, hash-verified

161
162 @torch.no_grad()
163 def forward(self, pixel_values):
164 g_cache_manager.cache_env_in()
165 input_embs = self.pre_infer.forward(pixel_values, self.pre_post_weight)
166 for i in range(self.layers_num + self.select_layer + 1):
167 input_embs = self.layers_infer[i].forward(input_embs, self.trans_layers_weight[i])
168 input_embs = self.post_infer.forward(input_embs[:, 1:, :], self.pre_post_weight)
169 g_cache_manager.cache_env_out()
170 return input_embs
171
172 @torch.no_grad()
173 def encode(self, images: List[ImageItem]):

Callers 6

_check_max_len_inferMethod · 0.95
encodeMethod · 0.95
tppart_model_inferFunction · 0.95
run_forward_onceFunction · 0.45
prefillFunction · 0.45
decodeFunction · 0.45

Calls 2

cache_env_inMethod · 0.80
cache_env_outMethod · 0.80

Tested by 1

tppart_model_inferFunction · 0.76