Skip to content

Torch Device Support for Mac M1 series Metal (Hardware support) #46

Description

@prasad-yashdeep

The MacBooks are more than capable for running DL model on device now with GPU, so the notebooks should indeed also have support these devices as well.

Instead of having the following line , found in all the .ipynb files

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

We should replace it with ,

if torch.cuda.is_available():
    device = torch.device("cuda:0")
elif torch.backends.mps.is_available():
    device = torch.device("mps")
else:
    device = torch.device("cpu")

print(f"Using device: {device}")

Adding this will also help us bypass the limitations that have been put on training time , when trying to train on colab. As the T4 GPU on colab is only allotted for a very limited time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions