Haoxin Chen commited on
Commit
a8f3a29
1 Parent(s): 4df5632

update log time

Browse files
Files changed (2) hide show
  1. i2v_test.py +4 -0
  2. t2v_test.py +4 -0
i2v_test.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  from omegaconf import OmegaConf
3
 
4
  import torch
@@ -31,6 +32,8 @@ class Image2Video():
31
 
32
  def get_image(self, image, prompt, steps=50, cfg_scale=12.0, eta=1.0, fps=16):
33
  torch.cuda.empty_cache()
 
 
34
  gpu_id=0
35
  if steps > 60:
36
  steps = 60
@@ -61,6 +64,7 @@ class Image2Video():
61
  prompt_str=prompt_str[:30]
62
 
63
  save_videos(batch_samples, self.result_dir, filenames=[prompt_str], fps=self.save_fps)
 
64
  return os.path.join(self.result_dir, f"{prompt_str}.mp4")
65
 
66
  def download_model(self):
 
1
  import os
2
+ import time
3
  from omegaconf import OmegaConf
4
 
5
  import torch
 
32
 
33
  def get_image(self, image, prompt, steps=50, cfg_scale=12.0, eta=1.0, fps=16):
34
  torch.cuda.empty_cache()
35
+ print('start:', prompt, time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
36
+ start = time.time()
37
  gpu_id=0
38
  if steps > 60:
39
  steps = 60
 
64
  prompt_str=prompt_str[:30]
65
 
66
  save_videos(batch_samples, self.result_dir, filenames=[prompt_str], fps=self.save_fps)
67
+ print(f"Saved in {prompt_str}. Time used: {(time.time() - start):.2f} seconds")
68
  return os.path.join(self.result_dir, f"{prompt_str}.mp4")
69
 
70
  def download_model(self):
t2v_test.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  from omegaconf import OmegaConf
3
  import torch
4
  from scripts.evaluation.funcs import load_model_checkpoint, save_videos, batch_ddim_sampling
@@ -29,6 +30,8 @@ class Text2Video():
29
 
30
  def get_prompt(self, prompt, steps=50, cfg_scale=12.0, eta=1.0, fps=16):
31
  torch.cuda.empty_cache()
 
 
32
  gpu_id=0
33
  if steps > 60:
34
  steps = 60
@@ -52,6 +55,7 @@ class Text2Video():
52
  prompt_str=prompt_str[:30]
53
 
54
  save_videos(batch_samples, self.result_dir, filenames=[prompt_str], fps=self.save_fps)
 
55
  return os.path.join(self.result_dir, f"{prompt_str}.mp4")
56
 
57
  def download_model(self):
 
1
  import os
2
+ import time
3
  from omegaconf import OmegaConf
4
  import torch
5
  from scripts.evaluation.funcs import load_model_checkpoint, save_videos, batch_ddim_sampling
 
30
 
31
  def get_prompt(self, prompt, steps=50, cfg_scale=12.0, eta=1.0, fps=16):
32
  torch.cuda.empty_cache()
33
+ print('start:', prompt, time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
34
+ start = time.time()
35
  gpu_id=0
36
  if steps > 60:
37
  steps = 60
 
55
  prompt_str=prompt_str[:30]
56
 
57
  save_videos(batch_samples, self.result_dir, filenames=[prompt_str], fps=self.save_fps)
58
+ print(f"Saved in {prompt_str}. Time used: {(time.time() - start):.2f} seconds")
59
  return os.path.join(self.result_dir, f"{prompt_str}.mp4")
60
 
61
  def download_model(self):