implement LLaVA using candle
The code is based on https://github.com/haotian-liu/LLaVA, Hence the llava-hf version of config may perform differently.
The llava-hf models contain tokenizer.json, so if you want pure-rust experience, I suggest you to use llava-hf version.
Right now I have tested on liuhaotian/llava-v1.6-vicuna-7b and llava-hf/llava-v1.6-vicuna-7b-hf. The memory use might have room for optimization.
cargo run # default args, use liuhaotian/llava-v1.6-vicuna-7b, default-image is image/llava_logo.png, prompt is "is this a cat?"
cargo run -- --image-file "images/llava_v1_5_radar.jpg" --prompt "what does this picture show?"
cargo run -- --model-path "llava-hf/llava-v1.6-vicuna-7b-hf" # use llava-hf model
Download the corresponding weights from Hugging Face
Load the model weights and configs
image preprocess
conv template (partial, only implement conv_llava_v1 and conv_chatml_direct, which is enough for LLaVA v1.6)
Model structure Implementation
model forward
main process
quantization
(long term) Expand candle operators, including:
top priority migrate to support llava-hf series model
LoRA
contribution to other projects
memory optimization for LLaVA 1.6 version
(long term)model training c
conda create -n llava python=3.10
pip install transformers protobuf
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download liuhaotian/llava-v1.6-vicuna-7b
43 commits
Rust
100.0%
implement LLaVA using candle
The code is based on https://github.com/haotian-liu/LLaVA, Hence the llava-hf version of config may perform differently.
The llava-hf models contain tokenizer.json, so if you want pure-rust experience, I suggest you to use llava-hf version.
Right now I have tested on liuhaotian/llava-v1.6-vicuna-7b and llava-hf/llava-v1.6-vicuna-7b-hf. The memory use might have room for optimization.
cargo run # default args, use liuhaotian/llava-v1.6-vicuna-7b, default-image is image/llava_logo.png, prompt is "is this a cat?"
cargo run -- --image-file "images/llava_v1_5_radar.jpg" --prompt "what does this picture show?"
cargo run -- --model-path "llava-hf/llava-v1.6-vicuna-7b-hf" # use llava-hf model
Download the corresponding weights from Hugging Face
Load the model weights and configs
image preprocess
conv template (partial, only implement conv_llava_v1 and conv_chatml_direct, which is enough for LLaVA v1.6)
Model structure Implementation
model forward
main process
quantization
(long term) Expand candle operators, including:
top priority migrate to support llava-hf series model
LoRA
contribution to other projects
memory optimization for LLaVA 1.6 version
(long term)model training c
conda create -n llava python=3.10
pip install transformers protobuf
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download liuhaotian/llava-v1.6-vicuna-7b
43 commits
Rust
100.0%