-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
35 lines (29 loc) · 827 Bytes
/
test.py
File metadata and controls
35 lines (29 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import torch
import os
import config
import numpy as np
from PIL import Image
from torchvision.utils import save_image
from model import Generator
from utils import load_checkpoint, plot_examples
from torch import nn
from torch import optim
import os, random
import argparse
#create the code as easy as you can
result_path = "./Test_Results"
isExist = os.path.exists(result_path)
if not isExist:
os.makedirs(result_path)
gen = Generator(alpha = 0.4, beta = 0.1, in_channels=3).to(config.DEVICE)
opt_gen = optim.Adam(gen.parameters(), lr=config.LEARNING_RATE, betas=(0.9, 0.999))
if config.LOAD_MODEL:
load_checkpoint(
config.CHECKPOINT_GEN,
gen,
opt_gen,
config.LEARNING_RATE,
)
src = "./demo/"
#src = "./internet/"
plot_examples(src, gen, result_path)