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

[Question] How to customize the loss calculation for PPO #2028

Open
4 tasks done
olmoulin opened this issue Oct 26, 2024 · 3 comments
Open
4 tasks done

[Question] How to customize the loss calculation for PPO #2028

olmoulin opened this issue Oct 26, 2024 · 3 comments
Labels
check the checklist You have checked the required items in the checklist but you didn't do what is written... more information needed Please fill the issue template completely question Further information is requested

Comments

@olmoulin
Copy link

❓ Question

Hi,
For a research purpose, I need to modify the loss calculation for PPO in order to take into account another parameter ... I have modified the PPO.py file as follow : loss = (policy_loss + self.ent_coef * entropy_loss + self.vf_coef * value_loss + gen_loss), gen_loss being my new parameter ... but this has absolutely no impact on the training ... not sure, but am I making something wrong there ? thanks a lot in adance.

Checklist

@olmoulin olmoulin added the question Further information is requested label Oct 26, 2024
@araffin
Copy link
Member

araffin commented Oct 26, 2024

Probably a duplicate of #1881

@araffin araffin added duplicate This issue or pull request already exists more information needed Please fill the issue template completely check the checklist You have checked the required items in the checklist but you didn't do what is written... labels Oct 26, 2024
@olmoulin
Copy link
Author

olmoulin commented Oct 26, 2024

This is what I have applied, and it does run properly my code, but it seems that no matter how much you modify the loss calculation it has no impact ... am I missing something ?
Can you please then remove the duplicate tag on it. thanks

@araffin
Copy link
Member

araffin commented Oct 28, 2024

This is what I have applied,

then this should be fine.

how much you modify the loss calculation it has no impact

No impact on the behavior?
You should be able to log the total loss and see some difference (while fixing the seed).
You can also check the parameters value.

@araffin araffin removed the duplicate This issue or pull request already exists label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
check the checklist You have checked the required items in the checklist but you didn't do what is written... more information needed Please fill the issue template completely question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants