question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Policy Network - Off-Policy Algorithm - Advanced Customization

See original GitHub issue

📚 Documentation

As stated in the documentation, for using a Custom Policy Network for off-policy algorithms #425 is linked which shows an example of how to do this. At the end register_policy("CustomTD3Policy", CustomTD3Policy) is used to use the Custom Policy e.g. for TD3/DDPG. Since it looks like, that in the commit https://github.com/DLR-RM/stable-baselines3/commit/254bb10c42e8f892e43af9da25aefc7c604c317c the register_policy-function was deleted/replaced, how can this be handled with the current version of SB3?

Checklist

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
araffincommented, Oct 18, 2022

Hello, if you want the same feature as the register policy, the actual syntax is:

from stable_baselines3 import TD3
from stable_baselines3.td3.policies import TD3Policy

TD3.policy_aliases["CustomTD3Policy"] = TD3Policy

TD3("CustomTD3Policy", "MountainCarContinuous-v0").learn(5_000)

I’ll update the issue

1reaction
qgallouedeccommented, Oct 18, 2022

Thank you for reporting. We will update the documentation.

Use the following syntax:

from stable_baselines3 import TD3
from stable_baselines3.td3.policies import TD3Policy


class CustomTD3Policy(TD3Policy):
    ...


TD3(CustomTD3Policy, "MountainCarContinuous-v0").learn(5_000)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Policy Network - Stable Baselines3 - Read the Docs
Stable Baselines3 provides policy networks for images (CnnPolicies), other type of input ... For advanced customization of off-policy algorithms policies, ...
Read more >
Too many errors when customizing policy, a full example for ...
To answer your original request, giving an advanced customization example for any off-policy algorithm is not really possible as each algorithm ...
Read more >
Customization of RL policies using StableBaselines3 - Medium
We can customize the RL algorithm by writing our own custom policy which can be utilized to train the RL agent. stablebaselines3 provides...
Read more >
How To Customize Policies — Ray 2.2.0
In the above section you saw how to compose a simple policy gradient algorithm with RLlib. In this example, we'll dive into how...
Read more >
How to customize crypto policies in RHEL 8.2 - Red Hat
To modify existing crypto policies, use policy modifier modules. These are text files that include policy instructions to the update-crypto- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found