Jiaqi-hkust commited on
Commit
671e9b3
·
verified ·
1 Parent(s): 95b4753

Update hawk/conversation/conversation_video.py

Browse files
hawk/conversation/conversation_video.py CHANGED
@@ -302,16 +302,16 @@ class Chat:
302
  video = self.vis_processor.transform(video)
303
  video_motion = self.vis_processor.transform(video_motion)
304
 
305
- video = video.unsqueeze(0).to(self.device)
306
- video_motion = video_motion.unsqueeze(0).to(self.device)
307
  # print(image)
308
  else:
309
  raise NotImplementedError
310
 
311
 
312
  # conv.system = "You can understand the video that the user provides. Follow the instructions carefully and explain your answers in detail."
313
- image_emb, _, _ = self.model.encode_videoQformer_visual(video) # 1,32,4096
314
- image_motion_emb, _, _ = self.model.encode_videoQformer_visual(video_motion, motion=True) # 1,32,4096
315
  img_list.append(torch.cat((image_emb, image_motion_emb), dim=1))
316
  # img_list.append(image_motion_emb)
317
  conv.append_message(conv.roles[0], "<Video><ImageHere></Video> ")
 
302
  video = self.vis_processor.transform(video)
303
  video_motion = self.vis_processor.transform(video_motion)
304
 
305
+ video = video.unsqueeze(0).to(self.device).clone().detach()
306
+ video_motion = video_motion.unsqueeze(0).to(self.device).clone().detach()
307
  # print(image)
308
  else:
309
  raise NotImplementedError
310
 
311
 
312
  # conv.system = "You can understand the video that the user provides. Follow the instructions carefully and explain your answers in detail."
313
+ image_emb, _, _ = self.model.encode_videoQformer_visual(video).clone().detach() # 1,32,4096
314
+ image_motion_emb, _, _ = self.model.encode_videoQformer_visual(video_motion, motion=True).clone().detach() # 1,32,4096
315
  img_list.append(torch.cat((image_emb, image_motion_emb), dim=1))
316
  # img_list.append(image_motion_emb)
317
  conv.append_message(conv.roles[0], "<Video><ImageHere></Video> ")