Ignore errors from new pytype version (#107)

This commit is contained in:
Antonin RAFFIN 2020-07-16 11:54:37 +02:00 committed by GitHub
parent 3cf6e9714b
commit 208890dfc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 - 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:
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View file

@ -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:

View file

@ -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)