here’s the snippet:
def gen_example(self, data_dic):
if cfg.TRAIN.NET_G == ‘’:
print(‘Error: the path for morels is not found!’)
else:
# Build and load the generator
text_encoder = 
RNN_ENCODER(self.n_words, nhidden=cfg.TEXT.EMBEDDING_DIM)
state_dict = 
torch.load(cfg.TRAIN.NET_E, map_location=lambda storage, loc: storage)
text_encoder.load_state_dict(state_dict)
print(‘Load text encoder from:’, cfg.TRAIN.NET_E)
text_encoder = text_encoder.cuda()
text_encoder.eval()
# the path to save generated images
if cfg.GAN.B_DCGAN:
netG = G_DCGAN()
else:
netG = G_NET()
s_tmp = cfg.TRAIN.NET_G[:cfg.TRAIN.NET_G.rfind(’.pth’)]
model_dir = cfg.TRAIN.NET_G
state_dict = \
USING GPU -NVIDIA GTX 1660Ti , Cuda version 9.0.176 , cudnn 7.4.1 , pytorch version = 1.0.0 in my pytorch environment
in my base cuda version is 10.2 and nvidia driver is 440IMG_20200515_1352253000×1715 2.69 MB