MacBook Pro 2020 Intel i5 - Problem running learning rate finder

Hello everyone,

I’m running an object detection Python notebook on a MacBook Pro 2020 13" with macOs Monterrey(v12.2.1).
When the execution reaches the function lr_find() I get the following warning:
[W ParallelNative.cpp:214] Warning: Cannot set number of intraop threads after parallel work has started or after set_num_threads call when using native parallel backend (function set_num_threads)

Plus, the execution of the cell of the function lr_find() doesn’t finish for itself and I’ve to stop the execution.

The environment I have on Mac OS is:

  • Python 3.8.9

  • fastai 2.5.3

  • torch 1.10.2

The CPU is an Intel Core i5 10th gen with 4 cores and the GPU is an Intel Iris Plus Graphics.

If I run the notebook on my desktop computer, it runs well.
My desktop computer has Windows 10, an NVIDIA GTX 1060 6 GB and an Intel Core i7 with 6 cores. The difference on the environment in relation to Mac OS is that on my desktop computer I have Python 3.7.6.

I want to be able to use my laptop for my deep learning project and for future ones. It’s a really expensive laptop that I recently bought and for it’s price I hoped it would respond well.

I searched related topics about my problem on forums but I didn’t find any post that would present a solution.

I would gladly appreciate if someone can give me any clue of how to fix this problem.

Thank you.


At the end of this post you can the find the key parts of my notebook until the learn.lr_find() function.

PD: I’ve run an example notebook (Training a Classifier — PyTorch Tutorials 1.10.1+cu102 documentation) and it ended it’s execution after 2 mins aprox. I noticed that the keyboard and specially the part above the touch bar got really heated even minutes after the execution of the notebook finished.

Code of my notebook:

%reload_ext autoreload
%autoreload 2
%matplotlib inline

import os

from import *

from import *
from torch.nn import L1Loss
import cv2
from skimage.util import montage
data = DataBlock(
    blocks=(ImageBlock, BBoxBlock,BBoxLblBlock),
    splitter = RandomSplitter (0.1),
    batch_tfms= [*aug_transforms(size=(120,160)), Normalize.from_stats(*imagenet_stats)]

# Load the data and show a batch # NOTE: research to explain more properly what the 2 next lines do 

dls = data.dataloaders(path_dl, path=path_dl, bs = 64) # NOTE: what does bs mean?
dls.show_batch(max_n=20, figsize=(9,6)) # NOTE: what do the values of figsize represent?

class LungDetector(nn.Module):
    def __init__(self, arch=models.resnet18): # was 18
        self.cnn = create_body(arch)
        self.head = create_head(num_features_model(self.cnn) * 2, 4)
    def forward(self, im):
        x = self.cnn(im)
        x = self.head(x)
        return 2 * (x.sigmoid_() - 0.5)

def loss_fn(preds, targs, class_idxs):
    return L1Loss()(preds, targs.squeeze())

learn = Learner(dls, LungDetector(arch=models.resnet50), loss_func=loss_fn)

learn.metrics = [lambda preds, targs, _: IoU(preds, targs.squeeze()).mean()]

learn._split([learn.model.cnn[:6], learn.model.cnn[6:], learn.model.head])



Are you trying to run actual training on your Mac laptop or are you just using the browser on it to access a remote machine via Jupyter notebooks? If you’re trying to do any training on your Mac laptop, you’re not going to get good performance. You need an Nvidia GPU which Apple does not support. If you can use one of the cloud services like Google colab, or one of the many other cloud options that will be the easiest. If you need/want to run locally I would strongly recommend setting up a machine running linux if you’re trying to do deep learning training on it. It has by far the best compatibility relative to Windows and OSX. If all you’re doing is accessing Jupyter on a remote deep learning machine on your Mac via the browser then you’ll be fine. This is what I do.

1 Like

Thank you so much for your suggestions.

I’ve run the notebook locally with Visual Studio Code.
I’m going to try Google Collaborate.
I’ll inform you about the performance.

1 Like


@matdmiller, I inform you that I tried running my notebook on Google Colab and it run well by selecting a GPU or a TPU.

I’ve used Colab for just 2 hours, but for the performance I experienced I recommend anybody with a similar problem as I had to try Colab because for the free plan you can run continuously a GPU/TPU for 12h.

At the end, I attach a website that is a Google Colab guide that helped me learn how to start using it and can help anybody that struggles to run deep learning locally without a powerful Nvidia GPU and wants to try Colab.

Great! I’m glad it’s working out well for you.