Openai on Streamlit Cloud, AttributeError: type object 'FineTune' has no attribute 'prepare_data'

Hi Guys!

I am a newbie to python and streamlit. I use streamlit cloud and try to prepare training data on it.

Here is my repository and streamlit app page:

There are 3 steps:

  1. input API key
  2. upload an excel file
  3. using openai.FineTune.prepare_data to turn the excel file into a jsonl file and download it

The error message says:

2023-05-09 03:02:34.710 Uncaught app exception

Traceback (most recent call last):

File “/app/fine-tune-testing/test.py”, line 25, in
jsonl = openai.FineTune.prepare_data(df=df)
AttributeError: type object ‘FineTune’ has no attribute ‘prepare_data’

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/fine-tune-testing/test.py”, line 32, in
except errors.AuthenticationError:
NameError: name ‘errors’ is not defined

======

Please can anyone tell me what goes wrong? Do I use the wrong version of openai in requirements.txt? Thank you so much!

You are using errors.AuthenticationError in the line 32 of test.py, but errors is undefined.

Besides, I don’t think openai.FineTune has an attribute prepare_data. What makes you think it does?

1 Like

openai.FineTune.prepare_data is a CLI command mentioned on this page.

And I found it in the openai github cli.py

So, I thought I can use it like that in the terminal. Can you tell me what I should do to call this openai.FineTune.prepare_data? Or this is not possible to use it like in a CLI command? Thank you!

1 Like

There is a class FineTune in openai and another, different one, in openai.cli. What I found in the docs apparently refers to the former but I guess you want the latter.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.