รหัสสำหรับ Paper Text2Reward: รางวัลการสร้างแบบจำลองภาษาสำหรับการเรียนรู้การเสริมแรง โปรดดูหน้าโครงการของเราสำหรับการสาธิตเพิ่มเติมและทรัพยากรที่เกี่ยวข้องกับปัจจุบัน
เพื่อสร้างสภาพแวดล้อมให้เรียกใช้รหัสนี้ในเชลล์:
# set up conda
conda create -n text2reward python=3.7
conda activate text2reward
# set up ManiSkill2 environment
cd ManiSkill2
pip install -e .
pip install stable-baselines3==1.8.0 wandb tensorboard
cd ..
cd run_maniskill
bash download_data.sh
# set up MetaWorld environment
cd ..
cd Metaworld
pip install -e .
# set up code generation
pip install langchain chromadb==0.4.0mujoco โปรดทำตามคำแนะนำจากที่นี่เพื่อติดตั้ง หลังจากนั้นโปรดลองใช้คำสั่งต่อไปนี้เพื่อยืนยันการติดตั้งที่ประสบความสำเร็จ: $ python3
>>> import mujoco_pyRuntimeError: vk::Instance::enumeratePhysicalDevices: ErrorInitializationFailedSome required Vulkan extension is not present. You may not use the renderer to render, however, CPU resources will be still available.Segmentation fault (core dumped) ในการปรับปรุงผลการทดลองของเราอีกครั้งคุณสามารถเรียกใช้สคริปต์ต่อไปนี้:
Maniskill2:
bash run_oracle.sh
bash run_zero_shot.sh
bash run_few_shot.shเป็นเรื่องปกติที่จะพบคำเตือนต่อไปนี้:
[svulkan2] [error] GLFW error: X11: The DISPLAY environment variable is missing
[svulkan2] [warning] Continue without GLFW.Metaworld:
bash run_oracle.sh
bash run_zero_shot.sh ประการแรกโปรดเพิ่มตัวแปรสภาพแวดล้อมต่อไปนี้ใน .bashrc (หรือ .zshrc ฯลฯ )
export PYTHONPATH= $PYTHONPATH : ~ /path/to/text2reward จากนั้นนำทางไปยังไดเรกทอรี text2reward/code_generation/single_flow และเรียกใช้สคริปต์ต่อไปนี้:
# generate reward code for Maniskill
bash run_maniskill_zeroshot.sh
bash run_maniskill_fewshot.sh
# generate reward code for MetaWorld
bash run_metaworld_zeroshot.sh โดยค่าเริ่มต้นสคริปต์ run_oracle.sh ด้านบนใช้รางวัลที่เขียนโดยผู้เชี่ยวชาญที่จัดทำโดยสภาพแวดล้อม สคริปต์ run_zero_shot.sh และ run_few_shot.sh ใช้รางวัลที่สร้างขึ้นที่ใช้ในการทดลองของเรา หากคุณต้องการเรียกใช้การทดลองใหม่ตามรางวัลที่คุณมีให้เพียงทำตามสคริปต์ทุบตีด้านบนและแก้ไขพารามิเตอร์ --reward_path ไปยังเส้นทางของรางวัลของคุณเอง
หากคุณพบว่างานของเรามีประโยชน์โปรดอ้างอิงเรา:
@inproceedings { xietext2reward ,
title = { Text2Reward: Reward Shaping with Language Models for Reinforcement Learning } ,
author = { Xie, Tianbao and Zhao, Siheng and Wu, Chen Henry and Liu, Yitao and Luo, Qian and Zhong, Victor and Yang, Yanchao and Yu, Tao } ,
booktitle = { The Twelfth International Conference on Learning Representations }
}