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)
| 84 | torch.backends.cudnn.benchmark = False |
| 85 | |
| 86 | def generate_examples(gen, steps, truncation=0.7, n=100): |
| 87 | """ |
| 88 | Tried using truncation trick here but not sure it actually helped anything, you can |
| 89 | remove it if you like and just sample from torch.randn |
| 90 | """ |
| 91 | gen.eval() |
| 92 | alpha = 1.0 |
| 93 | for i in range(n): |
| 94 | with torch.no_grad(): |
| 95 | noise = torch.tensor(truncnorm.rvs(-truncation, truncation, size=(1, config.Z_DIM, 1, 1)), device=config.DEVICE, dtype=torch.float32) |
| 96 | img = gen(noise, alpha, steps) |
| 97 | save_image(img*0.5+0.5, f"saved_examples/img_{i}.png") |
| 98 | gen.train() |
nothing calls this directly
no outgoing calls
no test coverage detected