Skip to content

Commit

Permalink
Adds warning if user specifies cache_dir
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Graham <[email protected]>
  • Loading branch information
marksgraham committed Aug 2, 2023
1 parent 569e4e2 commit 42414ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions monai/losses/perceptual.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from __future__ import annotations

import warnings

import torch
import torch.nn as nn

Expand Down Expand Up @@ -75,6 +77,10 @@ def __init__(

if cache_dir:
torch.hub.set_dir(cache_dir)
# raise a warning that this may change the default cache dir for all torch.hub calls
warnings.warn(
f"Setting cache_dir to {cache_dir}, this may change the default cache dir for all torch.hub calls."
)

self.spatial_dims = spatial_dims
self.perceptual_function: nn.Module
Expand Down

0 comments on commit 42414ff

Please sign in to comment.