Closed lamhk closed 5 years ago
Hi!
Amount of bars passed to the model (-b option) have to match amount used during the trainig. This value is set here: https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On/blob/master/Chapter08/train_model_conv.py#L16, and equal to 50 by default. So, you should pass -b 50
in command line to match.
Alternative would be to change the constant in train_model_conv.py.
Hi Shumuma, it works as explained about. Many thanks.
Hi after running the "train_model_conv.py", I tried to test the saved models using "run_model.py" using the below command but got size mismatch error as stated below. Any idea how I could fix it? Many thanks in advance.
Chapter08$ python3 run_model.py -d data/YNDX_160101_161231.csv -m saves/runs/mean_val-0.824.data -b 10 -n test --conv
Reading data/YNDX_160101_161231.csv Read done, got 131542 rows, 99752 filtered, 0 open prices adjusted Traceback (most recent call last): File "run_model.py", line 35, in
net.load_state_dict(torch.load(args.model, map_location=lambda storage, loc: storage))
File "/home/lamhk/Deep-RL-Hands-On/venv/Deep-RL/lib/python3.5/site-packages/torch/nn/modules/module.py", line 719, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for DQNConv1D:
size mismatch for fc_val.0.weight: copying a param of torch.Size([512, 256]) from checkpoint, where the shape is torch.Size([512, 5376]) in current model.
size mismatch for fc_adv.0.weight: copying a param of torch.Size([512, 256]) from checkpoint, where the shape is torch.Size([512, 5376]) in current model.