Tried using truncation trick here but not sure it actually helped anything, you can remove it if you like and just sample from torch.randn
(gen, steps, truncation=0.7, n=100)
| 280 | torch.backends.cudnn.benchmark = False |
| 281 | |
| 282 | def generate_examples(gen, steps, truncation=0.7, n=100): |
| 283 | """ |
| 284 | Tried using truncation trick here but not sure it actually helped anything, you can |
| 285 | remove it if you like and just sample from torch.randn |
| 286 | """ |
| 287 | gen.eval() |
| 288 | alpha = 1.0 |
| 289 | for i in range(n): |
| 290 | with torch.no_grad(): |
| 291 | noise = torch.tensor(truncnorm.rvs(-truncation, truncation, size=(1,Z_DIM, 1, 1)), device=DEVICE, dtype=torch.float32) |
| 292 | img = gen(noise, alpha, steps) |
| 293 | save_image(img*0.5+0.5, f"saved_examples/img_{i}.png") |
| 294 | gen.train() |
nothing calls this directly
no outgoing calls
no test coverage detected