PJLab-ADG / LimSim

LimSim & LimSim++: Integrated traffic and autonomous driving simulators with (M)LLM support
https://pjlab-adg.github.io/LimSim/
GNU General Public License v3.0
415 stars 35 forks source link

API error when using limsim++ #33

Closed Sephiroth1118 closed 1 month ago

Sephiroth1118 commented 1 month ago

Hi! I'm using limsim++ and encounter a problem about openai key, but I'm not sure whether it is the probelm of my key or the problem how I use it.

When I followed the Getting started, which export the openai key in the environment variable, and run ExampleLLMAgentCloseLoop.py, it told me my key is invalid. I added openai_api_key as a param in ChatOpenAI() in ExampleLLMAgentCloseLoop.py, OpenAIEmbeddings() in Memory.py and ChatOpenAI() in Reflection.py. ExampleLLMAgentCloseLoop.py worked well.

Then I want to try ExampleVLMAgentCloseLoop.py, it output an error like this:

Model initialized at 18:22:41.009. Network building finished at 18:22:45.297. Retrying in 1 seconds Network information commited at 18:22:45.532. { 'error': {

}

} Step #0.00 (0ms ?RT. ?UPS, TraCI: 2779ms, vehicles TOT 1 ACT 1 BUF 0) Step #10.00 (0ms ?RT. ?UPS, TraCI: 8ms, vehicles TOT 6 ACT 6 BUF 0) Step #20.00 (1ms ~= 100.00RT, ~10000.00UPS, TraCI: 9ms, vehicles TOT 11 ACT 10 Step #30.00 (0ms ?RT. ?UPS, TraCI: 11ms, vehicles TOT 16 ACT 15 BUF 0) Step #40.00 (0ms ?RT. ?UPS, TraCI: 8ms, vehicles TOT 20 ACT 18 BUF 1) Step #50.00 (0ms ?RT. ?UPS, TraCI: 10ms, vehicles TOT 26 ACT 24 BUF 0) Step #60.00 (1ms ~= 100.00RT, ~25000.00UPS, TraCI: 10ms, vehicles TOT 31 ACT 25Step #70.00 (1ms ~= 100.00RT, ~29000.00UPS, TraCI: 10ms, vehicles TOT 35 ACT 29Step #80.00 (1ms ~= 100.00RT, ~33000.00UPS, TraCI: 8ms, vehicles TOT 40 ACT 33 Step #90.00 (1ms ~= 100.00RT, ~37000.00UPS, TraCI: 9ms, vehicles TOT 44 ACT 37 Step #100.00 (1ms ~= 100.00RT, ~42000.00UPS, TraCI: 10ms, vehicles TOT 50 ACT 4Step #101.00 (0ms ?RT. ?UPS, TraCI: 4077ms, vehicles TOT 50 ACT 42 BUF 0)
Traceback (most recent call last): File "ExampleVLMAgentCloseLoop.py", line 295, in raise e File "ExampleVLMAgentCloseLoop.py", line 268, in ) = gpt4v.makeDecision() File "ExampleVLMAgentCloseLoop.py", line 43, in wrapper return func(*args, **kwargs) File "ExampleVLMAgentCloseLoop.py", line 168, in makeDecision ans = response['choices'][0]['message']['content'] KeyError: 'choices'

Is this error caused by my openai key?

By the way, when I use the carla-dev build from source, there will be a problem of mismatch between carla client API and server API, causing a RGB problem. ValueError: role_name: colors must have 3 channels (R, G, B) occurs when using get_blueprint_library() This problem can be solved by install carla using the wheel file provided in PythonAPI/carla/dist/, which is consistent with the server API. But carla only provide wheel file for python 3.10, while limsim++ is using python 3.8.10. Is there any way to solve this problem?

My issue is quite long. Thank you so much for yout time and patience to read it!

Sephiroth1118 commented 1 month ago

I solve API key problem. I just use the wrong key in VLM.