Code Monkey home page Code Monkey logo

llava-mole's Introduction

LLaVA-MoLE: Sparse Mixture of LoRA Experts for Mitigating Data Conflicts in Instruction Finetuning MLLMs

Release

  • [2024/03/04] Release model checkpoint and minimal inference code of LLaVA-MoLE.
  • [2024/01/30] LLaVA-MoLE paper is on arXiv [Paper Link].

Install

  1. Environment
conda create -n llava_mole python=3.10 -y
conda activate llava_mole
# install main packages
conda install torch==2.1.2 flash-attn==2.4.2 transformers==4.37.2
  1. Get Vicuna-v1.5 and patch it for MoE forward
cd $CKPT_ROOT # set to directory of checkpoint storage
git-lfs install
git clone https://huggingface.co/lmsys/vicuna-7b-v1.5
git clone https://huggingface.co/openai/clip-vit-large-patch14-336
# go to workspace and clone this repo
git clone https://github.com/forwchen/LLaVA-MoLE
export PROJ_ROOT={PATH_TO_CLONED_DIR} # set PROJ_ROOT to the cloned folder
cp $PROJ_ROOT/moe_patch/modeling_llama.py vicuna-7b-v1.5/modeling_llama.py

Inference

We provide the inference script for testing LLaVA-MoLE checkpoint on Tiny LVLM-eHub. First, checkout https://github.com/OpenGVLab/Multi-Modality-Arena and add llava_mole_infer.py to tiny_lvlm_evaluation/models. And download testing data to $LVLM_DATA. Need to also modify get_model of tiny_lvlm_evaluation/models/__init__.py to include the following lines:

    elif model_name == 'LLaVA_MoLE':
        from .llava_mole_infer import TestLLaVAMoLE
        return TestLLaVAMoLE(device)

Please rememer to add PROJ_ROOT to PYTHONPATH. Then run:

cd tiny_lvlm_evaluation
python updated_eval_tiny.py --model-name LLaVA_MoLE --device 0 \
    --sampled-root $LVLM_DATA

Citation

If you find this code useful for your research and applications, please cite using this BibTeX:

@article{chen2024llava,
  title={Llava-mole: Sparse mixture of lora experts for mitigating data conflicts in instruction finetuning mllms},
  author={Chen, Shaoxiang and Jie, Zequn and Ma, Lin},
  journal={arXiv preprint arXiv:2401.16160},
  year={2024}
}

llava-mole's People

Contributors

forwchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vhzy

llava-mole's Issues

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.