-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: put interface in the torchrec module and scuba impl in fbgemm, because it seems all GenericITEPModule needs a logger but only the references of GenericITEPModule in fbgemm module use scuba. Differential Revision: D69308574
- Loading branch information
1 parent
1afbf08
commit a05d412
Showing
3 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import logging | ||
from abc import ABC, abstractmethod | ||
from typing import Mapping, Optional, Tuple, Union | ||
|
||
logger: logging.Logger = logging.getLogger(__name__) | ||
|
||
|
||
class ITEPLogger(ABC): | ||
@abstractmethod | ||
def log_table_eviction_info( | ||
self, | ||
iteration: Optional[Union[bool, float, int]], | ||
rank: Optional[int], | ||
table_to_sizes_mapping: Mapping[str, Tuple[int, int]], | ||
eviction_tables: Mapping[str, float], | ||
) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def log_run_info( | ||
self, | ||
) -> None: | ||
pass | ||
|
||
|
||
class ITEPLoggerDefault(ITEPLogger): | ||
""" | ||
noop logger as a default | ||
""" | ||
|
||
def __init__( | ||
self, | ||
) -> None: | ||
""" | ||
Initialize ITEPLoggerScuba. | ||
""" | ||
pass | ||
|
||
def log_table_eviction_info( | ||
self, | ||
iteration: Optional[Union[bool, float, int]], | ||
rank: Optional[int], | ||
table_to_sizes_mapping: Mapping[str, Tuple[int, int]], | ||
eviction_tables: Mapping[str, float], | ||
) -> None: | ||
logger.info( | ||
f"iteration={iteration}, rank={rank}, table_to_sizes_mapping={table_to_sizes_mapping}, eviction_tables={eviction_tables}" | ||
) | ||
|
||
def log_run_info( | ||
self, | ||
) -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters