usail-hkust / LLMTSCS

Official code for article "LLMLight: Large Language Models as Traffic Signal Control Agents".
139 stars 12 forks source link

Reproduce the imitation result. #12

Closed Jarvis-K closed 2 months ago

Jarvis-K commented 2 months ago
  1. In what format should I prepare the collecting data? Can u provide the imitation data collection script?
  2. Can u provide the imitation data in one road to help a quick reproduction?
Gungnir2099 commented 2 months ago

You can run run_chatgpt.py to collect the fine-tuning data. It will be stored in ./GPT_logs.

Gungnir2099 commented 2 months ago

The file is named XXX_state_action_prompt_commonsense_no_calculation.json.

DA21S321D commented 2 months ago

Since the simulation time is 3600 for anon_4_4_hangzhou_real.json, how many rounds are needed to collect data from gpt4?

Gungnir2099 commented 2 months ago

The duration of the green signal phase is 30s. So, the collection needs about 120 rounds.

Gungnir2099 commented 2 months ago

In response to your concern, we provide the budget (in USD) for training LightGPT (with A800 GPUs) on the Jinan 1 dataset.

Data Collection Imitation Fine-tuning (1 GPU) Critic-Guided Policy Refinement (4 GPUs) Sum
Cost $135.53 $58.00 $5.52 $199.05
DA21S321D commented 2 months ago

Could you share just one map data collected with gpt? So that we don't have to run it again for the same thing. Thanks

Jarvis-K commented 2 months ago

You can run run_chatgpt.py to collect the fine-tuning data. It will be stored in ./GPT_logs.

The format of GPT_logs/xxx.json is not compatible with imitation learning. How can I transform the {state, state_incoming, prompt, action} to {instruction, output} which is required for imitation finetuning.

Gungnir2099 commented 2 months ago

Could you share just one map data collected with gpt? So that we don't have to run it again for the same thing. Thanks

I'm sorry, but our collected fine-tuning data for LLMLight isn't publicly available at this time because we're constantly refining it. However, the LightGPT trained on the Jinan 1 dataset is accessible. You're welcome to use its responses and gather data for additional fine-tuning purposes.

Gungnir2099 commented 2 months ago

You can run run_chatgpt.py to collect the fine-tuning data. It will be stored in ./GPT_logs.

The format of GPT_logs/xxx.json is not compatible with imitation learning. How can I transform the {state, state_incoming, prompt, action} to {instruction, output} which is required for imitation finetuning.

I have included the code for compiling {state, state_incoming, prompt, action} into {instruction, output} format. You can run python finetune/state_action_2_instructions.py --input_file STATE_ACTION_PROMPT_FILE --output_file INSTRUCTION_FILE to perform the transformation. Thank you for your feedback.

DA21S321D commented 2 months ago

Thanks for your kindness. I also checked this script. Since there are different files for different intersections : Hangzhou-4_4-anon_4_4_hangzhou_real-intersection_1_1-gpt-4-4_state_action_prompt_commonsense_no_calculation.json and Hangzhou-4_4-anon_4_4_hangzhou_real-intersection_1_2-gpt-4-4_state_action_prompt_commonsense_no_calculation.json ..., should i merge their output json (generated by running finetune/state_action_2_instructions.py) together as the instruction file to finetune this? :

python ./finetune/run_imitation_finetune.py --base_model MODEL_PATH 
                                            --data_path instruction file merged 
                                            --output_dir OUTPUT_DIR

You can run run_chatgpt.py to collect the fine-tuning data. It will be stored in ./GPT_logs.

The format of GPT_logs/xxx.json is not compatible with imitation learning. How can I transform the {state, state_incoming, prompt, action} to {instruction, output} which is required for imitation finetuning.

I have included the code for compiling {state, state_incoming, prompt, action} into {instruction, output} format. You can run python finetune/state_action_2_instructions.py --input_file STATE_ACTION_PROMPT_FILE --output_file INSTRUCTION_FILE to perform the transformation. Thank you for your feedback.

Gungnir2099 commented 2 months ago

Thanks for your kindness. I also checked this script. Since there are different files for different intersections : Hangzhou-4_4-anon_4_4_hangzhou_real-intersection_1_1-gpt-4-4_state_action_prompt_commonsense_no_calculation.json and Hangzhou-4_4-anon_4_4_hangzhou_real-intersection_1_2-gpt-4-4_state_action_prompt_commonsense_no_calculation.json ..., should i merge their output json (generated by running finetune/state_action_2_instructions.py) together as the instruction file to finetune this? :

python ./finetune/run_imitation_finetune.py --base_model MODEL_PATH 
                                            --data_path instruction file merged 
                                            --output_dir OUTPUT_DIR

You can run run_chatgpt.py to collect the fine-tuning data. It will be stored in ./GPT_logs.

The format of GPT_logs/xxx.json is not compatible with imitation learning. How can I transform the {state, state_incoming, prompt, action} to {instruction, output} which is required for imitation finetuning.

I have included the code for compiling {state, state_incoming, prompt, action} into {instruction, output} format. You can run python finetune/state_action_2_instructions.py --input_file STATE_ACTION_PROMPT_FILE --output_file INSTRUCTION_FILE to perform the transformation. Thank you for your feedback.

Yes. Each file includes the interaction records at an intersection. You can merge them all to build your instruction fine-tuning dataset.

Jarvis-K commented 2 months ago

Thanks for your response! It does address my issues. This issue gonna be closed.