Skip to content

Commit

Permalink
Remove logging from metrics computation (#2518)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2518

Followup to D64205895 to remove logging since that adds a lot of walltime to metrics update (see f656229217)

{F1944676792}

Reviewed By: iamzainhuda

Differential Revision: D64854969

fbshipit-source-id: ab6cfcbafecba7b69df66693e6eee5418d9e9007
  • Loading branch information
Nayef Ahmed authored and facebook-github-bot committed Oct 24, 2024
1 parent 7855789 commit 9669707
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions torchrec/metrics/rec_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import abc
import itertools
import logging
import math
from collections import defaultdict, deque
from dataclasses import dataclass
Expand Down Expand Up @@ -48,7 +47,6 @@
MetricPrefix,
)

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

RecModelOutput = Union[torch.Tensor, Dict[str, torch.Tensor]]

Expand Down Expand Up @@ -525,24 +523,15 @@ def _update(
task_names = [task.name for task in self._tasks]

if not isinstance(predictions, torch.Tensor):
logger.info(
"Converting predictions to tensors for RecComputeMode.FUSED_TASKS_COMPUTATION"
)
predictions = torch.stack(
[predictions[task_name] for task_name in task_names]
)

if not isinstance(labels, torch.Tensor):
logger.info(
"Converting labels to tensors for RecComputeMode.FUSED_TASKS_COMPUTATION"
)
labels = torch.stack(
[labels[task_name] for task_name in task_names]
)
if weights is not None and not isinstance(weights, torch.Tensor):
logger.info(
"Converting weights to tensors for RecComputeMode.FUSED_TASKS_COMPUTATION"
)
weights = torch.stack(
[weights[task_name] for task_name in task_names]
)
Expand Down

0 comments on commit 9669707

Please sign in to comment.