da03 commited on
Commit
24d0256
·
1 Parent(s): 9c6b57e
Files changed (1) hide show
  1. utils.py +5 -1
utils.py CHANGED
@@ -44,7 +44,11 @@ def sample_frame(model: LatentDiffusion, prompt: str, image_sequence: torch.Tens
44
  #print (c['c_crossattn'].shape)
45
  #print (c['c_crossattn'][0])
46
  print (prompt)
47
- c = {'c_concat': image_sequence.transpose(0, 1).unsqueeze(0)}
 
 
 
 
48
  print (image_sequence.shape, c['c_concat'].shape)
49
  #c = model.enc_concat_seq(c, c_dict, 'c_concat')
50
  # Zero out the corresponding subtensors in c_concat for padding images
 
44
  #print (c['c_crossattn'].shape)
45
  #print (c['c_crossattn'][0])
46
  print (prompt)
47
+ # reshape(B, L * C, H, W)
48
+ #height, width, channels = image_sequence.shape
49
+ # use einsum to reshape
50
+ image_sequence = torch.einsum('hwc->chw', image_sequence).unsqueeze(0)
51
+ c = {'c_concat': image_sequence}
52
  print (image_sequence.shape, c['c_concat'].shape)
53
  #c = model.enc_concat_seq(c, c_dict, 'c_concat')
54
  # Zero out the corresponding subtensors in c_concat for padding images