Image-Text-to-Text
Transformers
Safetensors
llava_llama
text-generation
llava
vision
ocr
custom_code
Instructions to use OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B
- SGLang
How to use OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B with Docker Model Runner:
docker model run hf.co/OpenGVLab/PIIP-LLaVA_CLIP-BL_512-448_7B
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -1
- README.md +40 -0
- config.json +49 -0
- generation_config.json +11 -0
- model-00001-of-00003.safetensors +3 -0
- model-00002-of-00003.safetensors +3 -0
- model-00003-of-00003.safetensors +3 -0
- model.safetensors.index.json +0 -0
- special_tokens_map.json +24 -0
- tokenizer.model +3 -0
- tokenizer_config.json +42 -0
- trainer_state.json +0 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -32,4 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 32 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
library_name: transformers
|
| 5 |
+
base_model:
|
| 6 |
+
- lmsys/vicuna-7b-v1.5
|
| 7 |
+
base_model_relation: merge
|
| 8 |
+
tags:
|
| 9 |
+
- llava
|
| 10 |
+
- vision
|
| 11 |
+
- ocr
|
| 12 |
+
- custom_code
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
This repository contains the PIIP-LLaVA_CLIP-BL_512-448_7B model, based on vicuna-7b-v1.5.
|
| 16 |
+
|
| 17 |
+
Please refer to our [**paper**](https://huggingface.co/papers/2501.07783) and [**GitHub repository**](https://github.com/OpenGVLab/PIIP/tree/main/llava) for introduction and usage.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
## Citation
|
| 22 |
+
|
| 23 |
+
If you find this project useful in your research, please consider citing:
|
| 24 |
+
|
| 25 |
+
```BibTeX
|
| 26 |
+
@article{piip,
|
| 27 |
+
title={Parameter-Inverted Image Pyramid Networks},
|
| 28 |
+
author={Zhu, Xizhou and Yang, Xue and Wang, Zhaokai and Li, Hao and Dou, Wenhan and Ge, Junqi and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
|
| 29 |
+
journal={arXiv preprint arXiv:2406.04330},
|
| 30 |
+
year={2024}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
@article{piip_v2,
|
| 34 |
+
title={Parameter-Inverted Image Pyramid Networks for Visual Perception and Multimodal Understanding},
|
| 35 |
+
author={Wang, Zhaokai and Zhu, Xizhou and Yang, Xue and Luo, Gen and Li, Hao and Tian, Changyao and Dou, Wenhan and Ge, Junqi and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
|
| 36 |
+
journal={arXiv preprint arXiv:2501.07783},
|
| 37 |
+
year={2025}
|
| 38 |
+
}
|
| 39 |
+
```
|
| 40 |
+
|
config.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "PIIP-LLaVA_CLIP-BL_512-448_7B",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlavaLlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"freeze_mm_mlp_adapter": false,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 4096,
|
| 13 |
+
"image_aspect_ratio": "pad",
|
| 14 |
+
"image_feature_multiply": 1.0,
|
| 15 |
+
"image_grid_pinpoints": null,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 11008,
|
| 18 |
+
"max_position_embeddings": 4096,
|
| 19 |
+
"mm_hidden_size": 1024,
|
| 20 |
+
"mm_patch_merge_type": "flat",
|
| 21 |
+
"mm_projector_lr": null,
|
| 22 |
+
"mm_projector_type": "mlp2x_gelu",
|
| 23 |
+
"mm_use_im_patch_token": false,
|
| 24 |
+
"mm_use_im_start_end": false,
|
| 25 |
+
"mm_vision_select_feature": "patch",
|
| 26 |
+
"mm_vision_select_layer": -2,
|
| 27 |
+
"mm_vision_tower": "configs/piip-llava_clip-bl_512-448_7B.py",
|
| 28 |
+
"model_type": "llava_llama",
|
| 29 |
+
"num_attention_heads": 32,
|
| 30 |
+
"num_hidden_layers": 32,
|
| 31 |
+
"num_key_value_heads": 32,
|
| 32 |
+
"pad_token_id": 0,
|
| 33 |
+
"pretraining_tp": 1,
|
| 34 |
+
"rms_norm_eps": 1e-05,
|
| 35 |
+
"rope_scaling": null,
|
| 36 |
+
"rope_theta": 10000.0,
|
| 37 |
+
"tie_word_embeddings": false,
|
| 38 |
+
"tokenizer_model_max_length": 2048,
|
| 39 |
+
"tokenizer_padding_side": "right",
|
| 40 |
+
"torch_dtype": "bfloat16",
|
| 41 |
+
"transformers_version": "4.37.2",
|
| 42 |
+
"tune_mm_mlp_adapter": false,
|
| 43 |
+
"tune_vision_tower": true,
|
| 44 |
+
"tune_vit_pos_embedding": false,
|
| 45 |
+
"use_cache": true,
|
| 46 |
+
"use_mm_proj": true,
|
| 47 |
+
"vision_tower_name": "configs/piip-llava_clip-bl_512-448_7B.py",
|
| 48 |
+
"vocab_size": 32000
|
| 49 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"attn_implementation": "flash_attention_2",
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 2,
|
| 6 |
+
"max_length": 4096,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"temperature": 0.9,
|
| 9 |
+
"top_p": 0.6,
|
| 10 |
+
"transformers_version": "4.37.2"
|
| 11 |
+
}
|
model-00001-of-00003.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8472bf632da026fa3627970bd85f0f1775bb42501edc231a82c0722d55b80a35
|
| 3 |
+
size 4938985352
|
model-00002-of-00003.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c3b478f2f095467e3209890bb488d1238b95c802cca0a0c1b25001fb6661260f
|
| 3 |
+
size 4947390880
|
model-00003-of-00003.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3188ae715a5338b666af1ae4aaca1adb2445f62bb273cfbfbe3b4954ddf0eb9
|
| 3 |
+
size 4556860648
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<unk>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<s>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "</s>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"bos_token": "<s>",
|
| 31 |
+
"clean_up_tokenization_spaces": false,
|
| 32 |
+
"eos_token": "</s>",
|
| 33 |
+
"legacy": false,
|
| 34 |
+
"model_max_length": 2048,
|
| 35 |
+
"pad_token": "<unk>",
|
| 36 |
+
"padding_side": "right",
|
| 37 |
+
"sp_model_kwargs": {},
|
| 38 |
+
"spaces_between_special_tokens": false,
|
| 39 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 40 |
+
"unk_token": "<unk>",
|
| 41 |
+
"use_default_system_prompt": false
|
| 42 |
+
}
|
trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:540f6b13c961396a4f7e6004386a9d271082a2cefe43b4aad8fb94c015857284
|
| 3 |
+
size 6779
|