Skip to content

Commit

Permalink
Add more related files.
Browse files Browse the repository at this point in the history
  • Loading branch information
payalcha committed Dec 10, 2024
1 parent a7e0c21 commit 49e5b36
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
30 changes: 0 additions & 30 deletions openfl/utilities/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,6 @@
import psutil
from rich.console import Console
from rich.logging import RichHandler
from tensorboardX import SummaryWriter

writer = None


def get_writer():
"""Create global writer object.
This function creates a global `SummaryWriter` object for logging to
TensorBoard.
"""
global writer
if not writer:
writer = SummaryWriter("./logs/tensorboard", flush_secs=5)


def write_metric(node_name, task_name, metric_name, metric, round_number):
"""Write metric callback.
This function logs a metric to TensorBoard.
Args:
node_name (str): The name of the node.
task_name (str): The name of the task.
metric_name (str): The name of the metric.
metric (float): The value of the metric.
round_number (int): The current round number.
"""
get_writer()
writer.add_scalar(f"{node_name}/{task_name}/{metric_name}", metric, round_number)


def setup_loggers(log_level=logging.INFO):
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def run(self):
'pandas',
'scikit-learn',
'flatten_json',
'tensorboardX',
'protobuf>=4.22,<6.0.0',
'grpcio>=1.56.2,<1.66.0',
],
Expand Down

0 comments on commit 49e5b36

Please sign in to comment.