Error while finding module specification for 'run_glue.py'

Code written:-

!pip install git+https://github.com/huggingface/transformers
!python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))"
!git clone https://github.com/huggingface/transformers.git
%cd "transformers/examples/pytorch/text-classification/"

!python3 -m run_glue.py --model_name_or_path "microsoft/deberta-v3-large" --task_name "mnli" --do_train --do_eval --evaluation_strategy steps --max_seq_length 256 --warmup_steps 50 --per_device_train_batch_size 8 --learning_rate 6e-6 --num_train_epochs 2  --output_dir "ds_results" --overwrite_output_dir --logging_steps 1000 --logging_dir "ds_results"

These commands were primarily taken from (and slightly modified) - microsoft/deberta-v3-large · Hugging Face
Error:-

/home/ec2-user/anaconda3/envs/pytorch_p36/bin/python: Error while finding module specification for 'run_glue.py' (AttributeError: module 'run_glue' has no attribute '__path__')

I have tried this on my own system it didn’t give this error. Am I missing something? @lewtun

I think the problem is that you’re using the -m flag which tries to import run_glue.py as a module and then run it. Does it work if you remove the -m flag?

Yes, it worked. thanks.

1 Like

Hey @lewtun do you know for how long the sagemaker jupyter notebook remains active on idle? and can it be increased?

For that question I’ll defer to our SageMaker expert - @philschmid :slight_smile:

1 Like

@NDugar I would rather recommend running your training using the HuggingFace estimator than the Notebook Instance. SageMaker will handle the management of the resources behind the scene and makes sure the training runs.

can you share an example on how to do that? also will it have enough space and RAM to train deberta v3 large on mnli?

Here is a example notebook: huggingface-course-sagemaker-talk/sagemaker-notebook.ipynb at master · philschmid/huggingface-course-sagemaker-talk · GitHub
The repository contains a example script train.py if you want to write your own fine-tuning script and if you want to use the example/ scripts of transformers the notebook also includes instructions for that.

1 Like