Skip to content

Commit

Permalink
fix pyre issue in timer
Browse files Browse the repository at this point in the history
Summary: Fix pyre issue and double logger definition

Differential Revision: D52810354
  • Loading branch information
galrotem authored and facebook-github-bot committed Jan 16, 2024
1 parent f540c04 commit ce4e0a0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions torchtnt/utils/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,18 @@
runtime_checkable,
Sequence,
Tuple,
TypeVar,
)

import numpy as np

import torch
import torch.distributed as dist
from tabulate import tabulate
from torch.distributed.distributed_c10d import Work
from torchtnt.utils.distributed import PGWrapper

logger: logging.Logger = logging.getLogger(__name__)

AsyncOperator = TypeVar("AsyncOperator")

logger: logging.Logger = logging.getLogger(__name__)

_TABLE_ROW = Tuple[str, float, int, float, float]
_TABLE_DATA = List[_TABLE_ROW]

Expand Down Expand Up @@ -451,15 +447,13 @@ def __init__(self, interval: datetime.timedelta, cpu_pg: dist.ProcessGroup) -> N
self._cpu_pg = cpu_pg
self._prev_time: float = perf_counter()
self._timeout_tensor: torch.Tensor = torch.zeros(1, dtype=torch.int)
# pyre-fixme[34]: `Variable[AsyncOperator]` isn't present in the function's parameters.
self._prev_work: Optional[AsyncOperator] = None
self._prev_work: Optional[Work] = None

def check(self) -> bool:
ret = False
curr_time = perf_counter()

if self._prev_work is not None:
# pyre-fixme[16]: `Variable[AsyncOperator]` has no attribute wait.
self._prev_work.wait()
ret = self._timeout_tensor[0].item() == 1
if ret:
Expand Down

0 comments on commit ce4e0a0

Please sign in to comment.