kumaran T
kumaran T

Reputation: 27

How to fix the error : "cannot import name 'GPT' from "gpt"

When I run the code below in Google Colab, I get the following error.

Note: I've already installed gpt using pip (!pip install gpt).

code

from gpt import GPT
from gpt import Example'

Error

cannot import name 'GPT' from 'gpt' (/usr/local/lib/python3.7/dist-packages/gpt/__init__.py)

Could someone help me fix this issue?

Upvotes: 1

Views: 3808

Answers (1)

SUMAN JHA
SUMAN JHA

Reputation: 11

It is because you have not imported gpt.py from the GitHub repository.

You can find it here.

  • Make sure you keep gpt.py in your current working folder
  • Do not forget to name your API key to openai.api_key as it is the variable in for API key in the gpt.py

Upvotes: 1

Related Questions