Search code examples
pythonpython-3.xjupyter-notebookgoogle-colaboratoryjupyter-lab

Why am I getting permission denied error in Google Colab?


I'm trying to train a GPT-2 model on Google Colab following this tutorial : Tutorial Link

But when I enter this line of code :

!PYTHONPATH=src ./train.py --dataset src/corpus/tdata.txt --model_name '345M' --batch_size 1 --learning_rate 0.00001

This gives me the error :

/bin/bash: ./train.py: /usr/bin/env: bad interpreter: Permission denied

How do I give superuser permissions in Google Colab ?


Solution

  • You need to change the permissions on train.py or its parent directory: Open a new cell and enter:

    !chmod 755 -R <dir_path>