How do I set a fastai learner to use the GPU on an M-Series Mac?

Ooo, yes, that may be onto something.

I’m guessing isinstance is torch.jit.isinstance?

Just a couple of problems though: I’m not sure what the parameter x takes and what Mapping is defined as. I did try inputting my learner as x, but I can’t execute the function because I’m not sure what Mapping is.

Judging from the isinstance docs though, I have to put a target object. I tried putting the fastai Learner class in place of Mapping, and then figured out that I can’t pass my learner as x, since it has no items attribute.

I’m guessing that the snippet you provided above is for changing the device of objects that store data (e.g., tensors), but that can be easly done through either tensor([1, 2, 3], device='mps') or tensor([1, 2, 3]).to(device='mps').

:thinking:

1 Like