controlled-text-generation
controlled-text-generation copied to clipboard
when running train_discriminator.py ,occuring cudnn RNN backward can only be called in training mode
Traceback (most recent call last):
File "train_discriminator.py", line 172, in
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"[email protected] Date: Mon, Apr 22, 2019 10:59 AM To: "wiseodd/controlled-text-generation"[email protected]; Cc: "zide05"[email protected];"Author"[email protected]; 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.pyThe 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_attrwithx_gen_attr.detach()intrain_discriminator.py. i.e inmodel.forward_encoder_embedandmodel.forward_discriminator_embed
It works, thanks very much!