Stuck in Lab2 - AutoModelForSeq2SeqLM not defined error

I am repeatedly getting stuck trying to complete Exercise 2 Fine-Tune the Model with Preprocessed Dataset in the lab for 2nd week. I keep getting the following error:
NameError: name ‘AutoModelForSeq2SeqLM’ is not defined
Any way to resolve this error? Otherwise I can’t proceed to Exercise 2.3 in the lab session. Appreciate your time.

1 Like

I’m not a mentor for this course, but in general, you have to run all of the cells starting from the top of the file, every time you open the notebook. That’s how the packages are imported and the workspace is configured.

Hi TMosh,
I am pretty sure I have run all the cells every time I opened the notebook. One additional observation I have made is that the kernel dies every time I have run the train model routine (this is before I run into the unrecognized name error). However since the message says it will restart automatically, I have not worried about it. Do you think it’s ok? Thx

1 Like

Hi @S_K2,
I am assuming the following statements are ran before you try using 'AutoModelForSeq2SeqLM.

%pip install
from transformers import AutoModelForSeq2SeqLM

The kernel is dying probably because it is not able to handle the job. Can you please restart the kernel with the recommended type in the lab sheet?

1 Like

This is the recommended kernel for lab2.

1 Like

Hi Sailesh,
I was having doubts about the kernel capabilities myself, but every time I set it up, it gets set up with 2 vCPU and 4GiB. It is definitely not 8vCPU and 32 GiB!!! How do I force the kernel to the config it is supposed to be? I was expecting it be correctly configured after I run those corresponding cells. Should I force the instance type to large? I think it is medium currently for some reason. Pls advice. Thx

  • Sudarshan
1 Like

Yes, please force it to the larger instance. For that you can hit the “No Kernel” at the top right corner of the notebook (As pointed out in the image I shared of the notebook). And then you will be presented with a dialog box to configure the instance type. Please choose instance type ml.m5.2xlarge. Hope this helps.

1 Like

OK. My AWS space is doing cleanup currently. Once I can restart my lab, will update kernel to 8vCPU and this thread with the outcome. Thanks a lot for your time.

1 Like

I had to manually set the kernel to 8vCPU and 32GiB during initialization. Everything worked correctly thereafter!!! For some reason my kernel was defaulting to 2vGPU and 4GiB. I wish that the startup scripts would take care of setting the kernel CPU and memory correctly without needing manual intervention. I lost a few hours, but the support from the mentors in this group has been stellar. Appreciate everyone’s support. Thx

Glad that helped unblock.