mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-09-17 22:30:59 +00:00
Ignore errors from new pytype version (#107)
This commit is contained in:
parent
3cf6e9714b
commit
208890dfc8
3 changed files with 5 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ Others:
|
||||||
- Split the ``collect_rollout()`` method for off-policy algorithms
|
- Split the ``collect_rollout()`` method for off-policy algorithms
|
||||||
- Added ``_on_step()`` for off-policy base class
|
- Added ``_on_step()`` for off-policy base class
|
||||||
- Optimized replay buffer size by removing the need of ``next_observations`` numpy array
|
- Optimized replay buffer size by removing the need of ``next_observations`` numpy array
|
||||||
|
- Ignored errors from newer pytype version
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,8 @@ class BaseAlgorithm(ABC):
|
||||||
env = data["env"]
|
env = data["env"]
|
||||||
|
|
||||||
# noinspection PyArgumentList
|
# 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
|
# load parameters
|
||||||
model.__dict__.update(data)
|
model.__dict__.update(data)
|
||||||
|
|
@ -350,7 +351,7 @@ class BaseAlgorithm(ABC):
|
||||||
# Sample gSDE exploration matrix, so it uses the right device
|
# Sample gSDE exploration matrix, so it uses the right device
|
||||||
# see issue #44
|
# see issue #44
|
||||||
if model.use_sde:
|
if model.use_sde:
|
||||||
model.policy.reset_noise()
|
model.policy.reset_noise() # pytype: disable=attribute-error
|
||||||
return model
|
return model
|
||||||
|
|
||||||
def set_random_seed(self, seed: Optional[int] = None) -> None:
|
def set_random_seed(self, seed: Optional[int] = None) -> None:
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class BaseModel(nn.Module, ABC):
|
||||||
device = get_device(device)
|
device = get_device(device)
|
||||||
saved_variables = th.load(path, map_location=device)
|
saved_variables = th.load(path, map_location=device)
|
||||||
# Create policy object
|
# Create policy object
|
||||||
model = cls(**saved_variables['data'])
|
model = cls(**saved_variables['data']) # pytype: disable=not-instantiable
|
||||||
# Load weights
|
# Load weights
|
||||||
model.load_state_dict(saved_variables['state_dict'])
|
model.load_state_dict(saved_variables['state_dict'])
|
||||||
model.to(device)
|
model.to(device)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue