Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing numpy package from src/lightning #19959

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added torch.bool in logger.py
  • Loading branch information
Bhavay-2001 committed Jun 7, 2024
commit 6530b36bb0779ba7c0a1ccf736567c4a2bf159d5
3 changes: 2 additions & 1 deletion src/lightning/fabric/utilities/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing import Any, Dict, Mapping, MutableMapping, Optional, Union

import numpy as np
import torch
from torch import Tensor


Expand Down Expand Up @@ -125,7 +126,7 @@ def _sanitize_params(params: Dict[str, Any]) -> Dict[str, Any]:
"""
for k in params:
# convert relevant np scalars to python types first (instead of str)
if isinstance(params[k], (np.bool_, np.integer, np.floating)):
if isinstance(params[k], (torch.bool, np.integer, np.floating)):
params[k] = params[k].item()
elif type(params[k]) not in [bool, int, float, str, Tensor]:
params[k] = str(params[k])
Expand Down
Loading