Skip to content

Commit

Permalink
Make torchaudio loading optional when compiling for AMD
Browse files Browse the repository at this point in the history
Summary: TSIA

Differential Revision: D57803200

fbshipit-source-id: e45fef35243258cccd41b8bdca6b0893fab94a3d
  • Loading branch information
Yury Gitman authored and facebook-github-bot committed May 25, 2024
1 parent f704bc5 commit ebe5b31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mmf/datasets/processors/image_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def __init__(self, config, *args, **kwargs):

transform = getattr(transforms, transform_type, None)
if transform is None:
from mmf.utils.env import setup_torchaudio
if not (torch.cuda.is_available() and torch.version.hip):
from mmf.utils.env import setup_torchaudio

setup_torchaudio()
from torchaudio import transforms as torchaudio_transforms
setup_torchaudio()
from torchaudio import transforms as torchaudio_transforms

transform = getattr(torchaudio_transforms, transform_type, None)
transform = getattr(torchaudio_transforms, transform_type, None)
# If torchvision or torchaudiodoesn't contain this, check our registry
# if we implemented a custom transform as processor
if transform is None:
Expand Down

0 comments on commit ebe5b31

Please sign in to comment.