-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Introduce protocol LearningLogger for logging with `offline_learning`. Reviewed By: PavlosApo Differential Revision: D65361620 fbshipit-source-id: 9fe9c9a4752cb549185c163d37c282a90d55921a
- Loading branch information
1 parent
c11becd
commit ececba7
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
pearl/utils/functional_utils/train_and_eval/learning_logger.py
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,26 @@ | ||
# (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. | ||
|
||
# pyre-strict | ||
|
||
from typing import Any, Dict, Protocol | ||
|
||
|
||
class LearningLogger(Protocol): | ||
"""Protocol for a learning logger. | ||
A learning logger is a callable that takes in a dictionary of results and a step number. | ||
It can be used to log the results of a learning process to a database or a file. | ||
Args: | ||
results: A dictionary of results. | ||
step: The current step of the learning process. | ||
prefix: A prefix to add to the logged results. | ||
""" | ||
|
||
def __call__(self, results: Dict[str, Any], step: int, prefix: str = "") -> None: | ||
pass | ||
|
||
|
||
def null_learning_logger(results: Dict[str, str], step: int, prefix: str = "") -> None: | ||
""" | ||
A null learning logger that does nothing. | ||
""" | ||
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
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