Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem of max_grad_norm in PPOPolicy #270

Closed
hyx1999 opened this issue Jan 10, 2021 · 3 comments
Closed

problem of max_grad_norm in PPOPolicy #270

hyx1999 opened this issue Jan 10, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@hyx1999
Copy link

hyx1999 commented Jan 10, 2021

The parameter "max_grad_norm" is optional in the PPOPolicy parameter list, but in the training phase, PPOPolicy will require that the value of max_grad_norm cannot be None (but the default value of max_grad_norm is None).

@Trinkle23897
Copy link
Collaborator

Trinkle23897 commented Jan 10, 2021

I don't think so.

if self._max_grad_norm:

This line checks if max_grad_norm is not None. If this parameter is None, it will directly bypass these lines.
I don't see any other lines that require max_grad_norm not None, could you please elaborate on it?

@hyx1999
Copy link
Author

hyx1999 commented Jan 11, 2021

Sorry, but the ppo algorithm in the tianshou package I installed via pip is different from the code you showed. I tried to update tianshou through pip install tianshou --upgrade and pip install tianshou --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple, but it seems that there is no change. maybe I should use pip install git+https://github.com/thu-ml/tianshou.git@master --upgrade?

line 180 to line 182

loss.backward()
nn.utils.clip_grad_norm_(
    list(self.actor.parameters())
    + list(self.critic.parameters()),
    self._max_grad_norm)
self.optim.step()

The version of tianshou I currently use is as follows

>>> import tianshou as ts
>>> ts.__version__
'0.3.0.post1'
>>> 

@Trinkle23897
Copy link
Collaborator

Trinkle23897 commented Jan 11, 2021

Okay, it's my bad. I'll post a new release soon (after merge #263).

@Trinkle23897 Trinkle23897 added the bug Something isn't working label Jan 11, 2021
@hyx1999 hyx1999 closed this as completed Jan 11, 2021
Trinkle23897 added a commit to zhujl1991/tianshou that referenced this issue Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants