Merge branch 'master' into sde

This commit is contained in:
Antonin RAFFIN 2020-07-16 11:56:35 +02:00
commit a96970c7c0
3 changed files with 5 additions and 3 deletions

View file

@ -37,6 +37,7 @@ Others:
- Split the ``collect_rollout()`` method for off-policy algorithms
- Added ``_on_step()`` for off-policy base class
- Optimized replay buffer size by removing the need of ``next_observations`` numpy array
- Ignored errors from newer pytype version
Documentation:
^^^^^^^^^^^^^^

View file

@ -330,7 +330,8 @@ class BaseAlgorithm(ABC):
env = data["env"]
# noinspection PyArgumentList
model = cls(policy=data["policy_class"], env=env, device='auto', _init_setup_model=False)
model = cls(policy=data["policy_class"], env=env,
device='auto', _init_setup_model=False) # pytype: disable=not-instantiable,wrong-keyword-args
# load parameters
model.__dict__.update(data)
@ -350,7 +351,7 @@ class BaseAlgorithm(ABC):
# Sample gSDE exploration matrix, so it uses the right device
# see issue #44
if model.use_sde:
model.policy.reset_noise()
model.policy.reset_noise() # pytype: disable=attribute-error
return model
def set_random_seed(self, seed: Optional[int] = None) -> None:

View file

@ -126,7 +126,7 @@ class BaseModel(nn.Module, ABC):
device = get_device(device)
saved_variables = th.load(path, map_location=device)
# Create policy object
model = cls(**saved_variables['data'])
model = cls(**saved_variables['data']) # pytype: disable=not-instantiable
# Load weights
model.load_state_dict(saved_variables['state_dict'])
model.to(device)