'ImportError: cannot import name 'amp' from 'apex' (unknown location) (Jupyter lab)

When I was trying to run huggingface models on Jupyterlab I faced this problem

from transformers import AutoModelForSeq2SeqLM, DataCollatorForSeq2Seq, Seq2SeqTrainingArguments, Seq2SeqTrainer


ImportError: cannot import name 'amp' from 'apex' (unknown location)


Solution 1:[1]

I was facing the same issue. After installing apex, the folder site-packages/apex is under a folder called apex-0.1-py3.8.egg. I moved the folder apex and EGG-INFO out of the apex-0.1-py3.8.egg folder and the issue was solved.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wenkai Li