GithubHelp home page GithubHelp logo

claucambra / plan4mc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pku-rl/plan4mc

0.0 0.0 0.0 54.11 MB

Reinforcement learning and planning for Minecraft.

License: MIT License

Python 100.00%

plan4mc's Introduction

Plan4MC: Skill Reinforcement Learning and Planning for Open-World Minecraft Tasks

Plan4MC is a multi-task agent in Minecraft, solving long-term tasks via planning over basic skills. It acquire three types of fine-grained basic skills through reinforcement learning without demonstrations. With a skill graph pre-generated by the Large Language Model, the skill search algorithm generates skill plans and interactively selects policies to solve complicated tasks. Plan4MC accomplishes 24 diverse hard tasks in Minecraft.

Installation

  • Install MineDojo environment following the official document. It requires python >= 3.9. We install jdk 1.8.0_171.

  • Upgrade the MineDojo package:

    • Delete the original package pip uninstall minedojo.
    • Download our modified MineDojo. Run python setup.py install.
    • To this end, you can successfully run validate_install.py here.
  • Install python packages in requirements.txt. Note that we require PyTorch>=1.8.1 and x-transformers==0.27.1.

  • Download the pretrained MineCLIP model named attn.pth. Move the file to mineclip_official/.

Tasks

  • We provide 24 diverse tasks configured in envs/hard_task_conf.yaml. To create an environment for a task:
from envs.minecraft_hard_task import MinecraftHardHarvestEnv
from minedojo.sim import InventoryItem
import utils
task_name = 'harvest_mutton_with_diamond_sword'
task_conf = utils.get_yaml_data('envs/hard_task_conf.yaml')[task_name]
init_items = {}
if 'initial_inventory' in task_conf:
    init_items = task_conf['initial_inventory']
    init_inv = [InventoryItem(slot=i, name=k, variant=None, quantity=task_conf['initial_inventory'][k]) for i,k in enumerate(list(task_conf['initial_inventory'].keys()))]
    task_conf['initial_inventory'] = init_inv
env = MinecraftHardHarvestEnv(image_size=(160,256), **task_conf)
  • To generate task names, initial plans and involved skills for all the tasks, run python plan_all_tasks.py.

Plan4MC

  • Pre-trained models for skills are released in skills/models/.

  • To test Plan4MC on the task 'get_furnace_nearby_with_logs' as an example, run python test.py --task get_furnace_nearby_with_logs. Arguments:

    --task: available tasks are listed in envs/hard_task_conf.yaml.

    --save-path: output directory for testing results.

    --test-episode: number of testing episodes.

    --save-gif: set to 1 to save testing videos.

Citation

@article{yuan2023plan4mc,
      title={{Plan4MC}: Skill Reinforcement Learning and Planning for Open-World {Minecraft} Tasks}, 
      author={Yuan, Haoqi and Zhang, Chi and Wang, Hongcheng and Xie, Feiyang and Cai, Penglin and Dong, Hao and Lu, Zongqing},
      journal={arXiv preprint arXiv:2303.16563},
      year={2023},
}

plan4mc's People

Contributors

claucambra avatar yhqpkueecs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.