CogVideo icon indicating copy to clipboard operation
CogVideo copied to clipboard

OpenAIError

Open cklogic opened this issue 1 year ago • 1 comments

OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

Cannot initialize model with low cpu memory usage because `accelerate` was not found in the environment. Defaulting to `low_cpu_mem_usage=False`. It is strongly recommended to install `accelerate` for faster and less memory-intense model loading. You can do so with: 

pip install accelerate

.
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00,  4.61it/s]
Loading pipeline components...: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:19<00:00,  3.88s/it]
2024-08-06 10:24:07.663 Uncaught app exception
Traceback (most recent call last):
  File "/home/xxx/anaconda3/envs/CogVideo/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling
    result = func()
  File "/home/xxx/anaconda3/envs/CogVideo/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec
    exec(code, module.__dict__)
  File "/data/public/xxx/app/CogVideo/inference/web_demo.py", line 214, in <module>
    main()
  File "/data/public/xxx/app/CogVideo/inference/web_demo.py", line 165, in main
    converted_prompt = convert_prompt(prompt=prompt, retry_times=1)
  File "/data/public/xxx/app/CogVideo/inference/convert_demo.py", line 38, in convert_prompt
    client = OpenAI()
  File "/home/xxxx/anaconda3/envs/CogVideo/lib/python3.10/site-packages/openai/_client.py", line 105, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

cklogic avatar Aug 06 '24 02:08 cklogic

OPENAI_API_KEY=your OpenAI Key streamlit run web_demo.py try this? it should work

zRzRzRzRzRzRzR avatar Aug 06 '24 03:08 zRzRzRzRzRzRzR