mterris commited on
Commit
dd93c31
·
1 Parent(s): a49aa2c

inpainting debug

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -80,6 +80,17 @@ def generate_imgs(x: torch.Tensor,
80
  print(f"[Before inference] CUDA max allocated: {torch.cuda.max_memory_allocated() / 1024**2:.2f} MB")
81
  print(f"[Before inference] CUDA max reserved: {torch.cuda.max_memory_reserved() / 1024**2:.2f} MB")
82
 
 
 
 
 
 
 
 
 
 
 
 
83
  ### Compute y
84
  with torch.no_grad():
85
  y = physics(x, use_gen) # possible reduction in img shape due to Blurring
 
80
  print(f"[Before inference] CUDA max allocated: {torch.cuda.max_memory_allocated() / 1024**2:.2f} MB")
81
  print(f"[Before inference] CUDA max reserved: {torch.cuda.max_memory_reserved() / 1024**2:.2f} MB")
82
 
83
+ if hasattr(physics.physics, 'imsize'):
84
+ physics.physics.imsize = x.shape[1:]
85
+ elif hasattr(physics.physics, 'img_size'):
86
+ physics.physics.img_size = x.shape[1:]
87
+ elif hasattr(physics.physics, 'tensor_size'):
88
+ physics.physics.tensor_size = x.shape[1:]
89
+
90
+ if physics.physics_generator is not None: # we only change physic params but not noise levels
91
+ if hasattr(physics.physics_generator, 'tensor_size'):
92
+ physics.physics_generator.tensor_size = x.shape[1:]
93
+
94
  ### Compute y
95
  with torch.no_grad():
96
  y = physics(x, use_gen) # possible reduction in img shape due to Blurring