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:
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 fast.ai 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.
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 os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="1" from fastai.vision.all import * from fastai.vision import * from torch.nn import L1Loss import cv2 from skimage.util import montage
data = DataBlock( blocks=(ImageBlock, BBoxBlock,BBoxLblBlock), get_items=get_image_files, n_inp=1, get_y=get_y, 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 super().__init__() 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]) learn.freeze_to(-1) learn.lr_find() learn.recorder.plot()