Closed cook-kuk closed 3 years ago
The initial code for the RL optimization (i.e. the code you are running) was written for CPU, not GPU execution. I suggest you to try running the code on CPU.
Does training with CPU take a long time?
If all components are pre-trained, RL optimization usually takes not more than 30min on a standard Laptop.
Thanks
It works fine after changing the pytorch version to cpu.
I found an error like that.
I think this is because the model mode is set to eval. So I change all models to train, but it doesn't work well.
self.predictor.train() self.encoder.train() self.generator.train()
rl_loss.backward()
Which model should I turn into a train to work?
C:\Users\seungho.kuk\anaconda3\envs\paccmann_rl\lib\site-packages\torch\nn\modules\container.py:100: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. input = module(input) Traceback (most recent call last): File "C:/Users/seungho.kuk/Desktop/Python_project/paccmann_rl/code/paccmann_generator/examples/train_paccmann_rl.py", line 314, in
main()
File "C:/Users/seungho.kuk/Desktop/Python_project/paccmann_rl/code/paccmann_generator/examples/train_paccmann_rl.py", line 220, in main
cell_line, epoch, params['batch_size']
File "C:\Users\seungho.kuk\anaconda3\envs\paccmann_rl\lib\site-packages\paccmann_generator\reinforce.py", line 442, in policy_gradient
rl_loss.backward()
File "C:\Users\seungho.kuk\anaconda3\envs\paccmann_rl\lib\site-packages\torch\tensor.py", line 195, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "C:\Users\seungho.kuk\anaconda3\envs\paccmann_rl\lib\site-packages\torch\autograd__init__.py", line 99, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: cudnn RNN backward can only be called in training mode