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

pyre - remove pyre-ignore annotations from state.py #535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions torchtnt/framework/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# ignore errors due to `Any` type

import logging
from enum import auto, Enum
Expand Down Expand Up @@ -64,8 +63,7 @@ class PhaseState:
def __init__(
self,
*,
# pyre-fixme[2]: Parameter annotation cannot contain `Any`.
dataloader: Iterable[Any],
dataloader: Iterable[object],
max_epochs: Optional[int] = None, # used only for train
max_steps: Optional[int] = None, # used only for train
max_steps_per_epoch: Optional[int] = None,
Expand All @@ -78,23 +76,20 @@ def __init__(
_check_loop_condition("evaluate_every_n_steps", evaluate_every_n_steps)
_check_loop_condition("evaluate_every_n_epochs", evaluate_every_n_epochs)

# pyre-fixme[4]: Attribute annotation cannot contain `Any`.
self._dataloader: Iterable[Any] = dataloader
self._dataloader: Iterable[object] = dataloader
self._max_epochs = max_epochs
self._max_steps = max_steps
self._max_steps_per_epoch = max_steps_per_epoch
self._evaluate_every_n_steps = evaluate_every_n_steps
self._evaluate_every_n_epochs = evaluate_every_n_epochs

# pyre-fixme[4]: Attribute annotation cannot be `Any`.
self._step_output: Any = None
self._step_output: object = None
self._iteration_timer = BoundedTimer(
cuda_sync=False, lower_bound=1_000, upper_bound=5_000
)

@property
# pyre-fixme[3]: Return annotation cannot contain `Any`.
def dataloader(self) -> Iterable[Any]:
def dataloader(self) -> Iterable[object]:
"""Dataloader defined by the user."""
return self._dataloader

Expand Down Expand Up @@ -124,8 +119,7 @@ def evaluate_every_n_epochs(self) -> Optional[int]:
return self._evaluate_every_n_epochs

@property
# pyre-fixme[3]: Return annotation cannot be `Any`.
def step_output(self) -> Any:
def step_output(self) -> object:
"""Output of the last step."""
return self._step_output

Expand Down
Loading