mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-17 08:56:08 +00:00
Added option to explicitly specify excluded parameters
This commit is contained in:
parent
e95858784a
commit
ee6f938ddc
1 changed files with 5 additions and 3 deletions
|
|
@ -517,17 +517,19 @@ class BaseRLModel(object):
|
||||||
"""
|
"""
|
||||||
return ["replay_buffer"]
|
return ["replay_buffer"]
|
||||||
|
|
||||||
def save(self, path, include=None):
|
def save(self, path, exclude=None, include=None):
|
||||||
"""
|
"""
|
||||||
saves all the params from init and pytorch params in a file for continuous learning
|
saves all the params from init and pytorch params in a file for continuous learning
|
||||||
|
|
||||||
:param path: (str) path to the file where the data should be saved
|
:param path: (str) path to the file where the data should be saved
|
||||||
|
:param exclude: (list) name of parameters that should be excluded, use standard exclude params if None
|
||||||
:param include: (list) name of parameters that might be excluded but should be included anyway
|
:param include: (list) name of parameters that might be excluded but should be included anyway
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
data = self.__dict__
|
data = self.__dict__
|
||||||
# get list of params to be excluded
|
# use standard list of excluded parameters if none given
|
||||||
exclude = self.excluded_save_params()
|
if exclude is None:
|
||||||
|
exclude = self.excluded_save_params()
|
||||||
# do not exclude params if they are specifically included
|
# do not exclude params if they are specifically included
|
||||||
if include is not None:
|
if include is not None:
|
||||||
exclude = [param_name for param_name in exclude if param_name not in include]
|
exclude = [param_name for param_name in exclude if param_name not in include]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue