MCPcopy Create free account
hub / github.com/EmbodiedGPT/EmbodiedGPT_Pytorch / get_video_embedding

Method get_video_embedding

demo/script.py:357–364  ·  view source on GitHub ↗
(self, video_file)

Source from the content-addressed store, hash-verified

355
356 @torch.no_grad()
357 def get_video_embedding(self, video_file):
358 pixel_values = load_video(video_file)
359 TC, H, W = pixel_values.shape
360 pixel_values = pixel_values.reshape(TC // 3, 3, H, W).transpose(0, 1) # [C, T, H, W]
361 pixel_values = pixel_values.unsqueeze(0).to(self.device, dtype=self.dtype)
362 assert len(pixel_values.shape) == 5
363 language_model_inputs = self.model.extract_feature(pixel_values)
364 return language_model_inputs
365
366 @torch.no_grad()
367 def answer(self, conversations, language_model_inputs, modal_type="image"):

Callers 1

post_questionMethod · 0.95

Calls 2

load_videoFunction · 0.70
extract_featureMethod · 0.45

Tested by

no test coverage detected