Open zide05 opened 5 years ago
Hey, you can solve this problem by adding:
model.train()
to line 152 in file train_discriminator.py
The problem is caused by the function call model.sample_sentence(z, c)
calling model.eval()
but not calling model.train()
afterwards.
oh,i get this,thank you!
---Original--- From: "Peter Lovett"notifications@github.com Date: Mon, Apr 22, 2019 10:59 AM To: "wiseodd/controlled-text-generation"controlled-text-generation@noreply.github.com; Cc: "zide05"845465009@qq.com;"Author"author@noreply.github.com; Subject: Re: [wiseodd/controlled-text-generation] when running train_discriminator.py ,occuring cudnn RNN backward can only be called in training mode (#24)
Hey, you can solve this problem by adding: model.train() to line 152 in file train_discriminator.py
The problem is caused by the function call model.sample_sentence(z, c) calling model.eval() but not calling model.train() afterwards.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hey, you can solve this problem by adding:
model.train()
to line 152 in filetrain_discriminator.py
The problem is caused by the function call
model.sample_sentence(z, c)
callingmodel.eval()
but not callingmodel.train()
afterwards.
this does not solve the issue. same error stays. Any solution??
Replace x_gen_attr
with x_gen_attr.detach()
in train_discriminator.py
. i.e in model.forward_encoder_embed
and model.forward_discriminator_embed
Replace
x_gen_attr
withx_gen_attr.detach()
intrain_discriminator.py
. i.e inmodel.forward_encoder_embed
andmodel.forward_discriminator_embed
It works, thanks very much!
Traceback (most recent call last): File "train_discriminator.py", line 172, in
main()
File "train_discriminator.py", line 140, in main
loss_G.backward()
File "/remote-home/yrchen/anaconda3/envs/py37_cuda8/lib/python3.7/site-packages/torch/tensor.py", line 102, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/remote-home/yrchen/anaconda3/envs/py37_cuda8/lib/python3.7/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: cudnn RNN backward can only be called in training mode