Giter Site home page Giter Site logo

clip4mc's Introduction

Reinforcement Learning Friendly Vision-Language Model for MineCraft

Code for paper "Reinforcement Learning Friendly Vision-Language Model for MineCraft" accepted by ECCV 2024 [PDF].

We propose a novel cross-modal contrastive learning framework architecture, CLIP4MC, aiming to learn a reinforcement learning (RL) friendly vision-language model (VLM) that serves as an intrinsic reward function for open-ended tasks. Simply utilizing the similarity between the video snippet and the language prompt is not RL-friendly since standard VLMs may only capture the similarity at a coarse level. To achieve RL-friendliness, we incorporate the task completion degree into the VLM training objective, as this information can assist agents in distinguishing the importance between different states.

arch

Moreover, we provide neat YouTube datasets based on the large-scale YouTube database provided by MineDojo. Specifically, two rounds of filtering operations guarantee that the dataset covers enough essential information and that the video-text pair is highly correlated. Empirically, we demonstrate that the proposed method achieves better performance on RL tasks compared with baselines.

Packages

Install python packages in requirements.txt.

Note that we require PyTorch>=1.10.0 and x-transformers==0.27.1.

Data

Dataset should get ready before training. Information of each data piece is available in our released dataset.

In this project we provide a naive implementation of dataloader and dataset. To use the dataloader and dataset, the data should be organized in the following structure:

data_dir_0
├── text_input.pkl
├── video_input.pkl
├── size.json
data_dir_1
├── text_input.pkl
├── video_input.pkl
├── size.json
...
data_dir_n
├── text_input.pkl
├── video_input.pkl
├── size.json

Use the tokenizer corresponding to the clip in AutoTokenizer to tokenize the natural language in the released dataset and save it as a pickle file. Convert the video clip with the corresponding timestamp into a pickle file.

A log file for each dataset is also required. The log file should be a json file with the following structure:

{
  "train": [data_dir_0, data_dir_1, ..., data_dir_n],
  "test" : [data_dir_0, data_dir_1, ..., data_dir_n],
}

The train and test keys are required. The train key should contain a list of data directories for training. The test key should contain a list of data directories for testing.

For the split of training and test sets, please refer to our released dataset.

The log file should be filled in the function get_processed_list in process/static.py.

Pretrained Models

  • A ViT-B/16 version of pretrained CLIP is required for training from scratch. You can download it from here.

Please fill in the path of the downloaded ViT-B-16 CLIP weight into the --pretrain_model_path of train_ddp_clip4mc.py and train_ddp_mineclip.py.

Usage

You can use the scripts below to train the model.

  • run_clip4mc.sh is used to run the training process of CLIP4MC.
  • run_mineclip.sh is used to run the training process of MineCLIP.

Citation

If you find our work useful in your research and would like to cite our project, please use the following citation:

@article{jiang2024reinforcement,
 title={Reinforcement Learning Friendly Vision-Language Model for Minecraft},
 author={Jiang, Haobin and Yue, Junpeng and Luo, Hao and Ding, Ziluo and Lu, Zongqing},
 journal={arXiv preprint arXiv:2303.10571},
 year={2024}
}

clip4mc's People

Contributors

lightet avatar sigmabm avatar

Stargazers

ShuchengLi 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.