PacktPublishing / Deep-Reinforcement-Learning-Hands-On

Hands-on Deep Reinforcement Learning, published by Packt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in ruuning the code in chapter 8

opened this issue · comments

Hi,

How to solve this error in training the model?
Error.docx

I would be happy to solve the problem as somos as possible.

Thanks.
Yaser

Hi!

Could you please put your error message as plain text here? Word Document is not very convenient to work with

find where the error happened, probably at where establishing the variable "done". You need to replace ".uint8" with ".bool", because the dtype torch.uint8 is now deprecated in the PyTorch version you are using. You can using finding order like "Ctrl + F" to find that.

.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a

This is the error I faced to when I am running the training_model.py:

dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
../aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprec

find where the error happened, probably at where establishing the variable "done". You need to replace ".uint8" with ".bool".

Hi,

The point is that I could not find any place that used .uint8

You're using wrong version of pytorch. Please install version which was stated in requirements.txt.
This warning is produced by new pytorch version, which shouldn't be used.

Hi,
I found the warning where it may arise, which is in Deep-Reinforcement-Learning-Hands-On/Chapter08/lib/common.py/
image

Yes, uint8 is unsigned Byte, so the two variable need to be replaced. But in line 95, you need to use "torch.BoolTensor" and you are welcome.

Hi,

Yes. you needs to replace those codes in the red rectangle in the following picture.
image

Hi,

  1. you just need to use the DQN formulation in place of the DDQN code in the original code, the DQN formulation is
    image

  2. If PLOT code exixts in the original code, you wil get that, otherwise you need to write it if you want get that.

  3. The error is kind of obvious, No such file in the path you given, you can check whether the mean_val-0.332.data exists.

ypb_personal@163.com

You can run this command:
python run_model.py -d ./data/YNDX_150101_151231.csv -m "the model's path" -n produced
Make sure that:

  • You have unpacked the csv files.

  • You have trained this model and it produced a model file such as checkpoint-1.data, you need to put the path of the model file behind "-m ", no double quotation marks.

As you can see, these parameters are required, and the meanings of them are written in the help. Other parameters are optional.
image

No, "lib/models.py" is not the model file, the model file was produced there.
image