HuggingFaceGuidedTourForMac icon indicating copy to clipboard operation
HuggingFaceGuidedTourForMac copied to clipboard

'bus error python' on M1 Mac in the 00-SystemCheck notebook

Open cip22 opened this issue 1 year ago • 2 comments

When I try to run the sentiment analysis, as soon as I execute nlp("I feel good"), I get

zsh: bus error python

The problem turned out to be this code: nlp = pipeline("sentiment-analysis") After this step, I get - among other info - this line back:

Hardware accelerator e.g. GPU is available in the environment, but no device argument is passed to the Pipeline object. Model will be on CPU.

So I decided to provide the 'device' argument. If MPS is present on the machine, I can create the pipeline like this: nlp = pipeline("sentiment-analysis", device="mps") The documentation is here: https://huggingface.co/docs/transformers/v4.44.0/en/main_classes/pipelines#transformers.pipeline

Now the sentiment analysis runs.

cip22 avatar Aug 19 '24 14:08 cip22

Yeah, similar issue happened in Mac book M1 pro, keep crashing Jupiter notebook when running the pipeline. it works after specified GPU acceleration: nlp = pipeline("sentiment-analysis", framework='pt',device=0). device=0 means using GPU, -1 means use CPU, default value is -1.

BruceWong001 avatar Nov 17 '24 05:11 BruceWong001

Interesting, so there seems to be more than one way to specify the device.

cip22 avatar Nov 17 '24 17:11 cip22