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

model.pretrain() using DDPG+HER #249

Closed
Cladett opened this issue Dec 1, 2020 · 5 comments · Fixed by #307
Closed

model.pretrain() using DDPG+HER #249

Cladett opened this issue Dec 1, 2020 · 5 comments · Fixed by #307
Labels
custom gym env Issue related to Custom Gym Env documentation Improvements or additions to documentation duplicate This issue or pull request already exists question Further information is requested

Comments

@Cladett
Copy link

Cladett commented Dec 1, 2020

Hello,

I have tried to use HER+DDPG to pretrain an agent based on some recorded demonstrations.
From the error I obtained i believe right now the library does not offer this feature, correct?
When i pretrain only using DDPG everything run smootly but with her i encounter problems.

Training with HER

  model_class = DDPG  # works also with SAC, DDPG and TD3                                                                                                        
 goal_selection_strategy = 'future' # equivalent to GoalSelectionStrategy.FUTURE                                                                                
 print('Ready to test HER')                                                                                                                                     
 model = HER('MlpPolicy', wrapped_env, model_class, n_sampled_goal=4, goal_selection_strategy=goal_selection_strategy,                                           tensorboard_log="./her_dvrl_tensorboard/" ,verbose=1 )                                                                                                                                                                 
                                                                                                                                                                
 # Pretrain the model using the demonstration                                                                                                                   
  model.pretrain(dataset, n_epochs=1000)                                                                                                                         
  model.save("./models/pretrain_1.12.20", cloudpickle = True)
@Cladett Cladett added custom gym env Issue related to Custom Gym Env question Further information is requested labels Dec 1, 2020
@Miffyli
Copy link
Collaborator

Miffyli commented Dec 1, 2020

Yes, there is no pretrain in stable-baselines3 (there is some crude support in stable-baselines). See e.g. d3rlpy for offline RL algorithms.

@Cladett
Copy link
Author

Cladett commented Dec 2, 2020

Thank you for your answer. How about the imitation library in stable-baselines3?
I thought that was the equivalent of model.pretrain() from stable-baselines.

@araffin araffin added the duplicate This issue or pull request already exists label Dec 2, 2020
@araffin
Copy link
Member

araffin commented Dec 2, 2020

Hello,
You have different solution:

  • if you just want to pretrain using behavior cloning, best is probably to write some custom code, we give some examples (see Add support for pretraining [feature request] #27 )
  • for behavior cloning, you can also take a look at the imitation repo (cf doc), but I'm not sure if HER is supported
  • if you want to use offline learning, then you can take a look at the offline learning repo that @Miffyli mentioned (but I'm also not sure that HER is supported there)

EDIT: note for myself, we need to add this to the migration guide, it is missing currently

@OscarGarciaF
Copy link

So there won't be any model.pretrain() in the future?

Why would a feature that was so simple to do on previous versions be missing: https://stable-baselines.readthedocs.io/en/master/guide/pretrain.html

@Miffyli
Copy link
Collaborator

Miffyli commented Dec 7, 2020

So there won't be any model.pretrain() in the future?

Not planned anytime soon as other libraries fill this part. It might be considered later on, however to correctly (and cleanly) support these would require extensive additions and careful implementing, hence we refer to other libraries focusing on those algorithms for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
custom gym env Issue related to Custom Gym Env documentation Improvements or additions to documentation duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants