From 87bf53fd0c594fd6b6e42181b78a5cfe9a32052c Mon Sep 17 00:00:00 2001 From: Gal Rotem Date: Mon, 11 Sep 2023 16:46:48 -0700 Subject: [PATCH] pyre - remove pyre-ignore annotations from state.py Summary: Remove pyre-ignore annotations from state.py by replacing Any with object Differential Revision: D49162433 --- torchtnt/framework/state.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/torchtnt/framework/state.py b/torchtnt/framework/state.py index 746ebc0653..b9fa23adc6 100644 --- a/torchtnt/framework/state.py +++ b/torchtnt/framework/state.py @@ -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 @@ -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, @@ -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 @@ -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