Image-Text-to-Text
Transformers
Safetensors
English
Chinese
bard_vl
text-generation
Bard-VL
VLM
vision-language
multimodal
discrete-diffusion
masked-decoding
custom_code
conversational
Instructions to use fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct
- SGLang
How to use fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct 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 "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct with Docker Model Runner:
docker model run hf.co/fudan-generative-ai/Bard-VL-B8-Mask-4B-Distil-Instruct
Update README.md
#6
by merryyuan - opened
README.md
CHANGED
|
@@ -74,14 +74,9 @@ Compared with a standard autoregressive VLM release style, Bard-VL emphasizes:
|
|
| 74 |
## π§ Method Structure
|
| 75 |
|
| 76 |
<p align="center">
|
| 77 |
-
<img src="./model.PNG" alt="Bard-VL method overview" width="
|
| 78 |
</p>
|
| 79 |
|
| 80 |
-
<p align="center">
|
| 81 |
-
<em>Pipeline, block-wise attention mask, and mixed-noise scheduler used by Bard-VL.</em>
|
| 82 |
-
</p>
|
| 83 |
-
|
| 84 |
-
---
|
| 85 |
|
| 86 |
## π Evaluation Results
|
| 87 |
|
|
@@ -129,15 +124,6 @@ accelerate==1.12.0
|
|
| 129 |
deepspeed==0.17.0
|
| 130 |
```
|
| 131 |
|
| 132 |
-
Recommended runtime settings in the local repository:
|
| 133 |
-
|
| 134 |
-
```bash
|
| 135 |
-
dtype = bfloat16
|
| 136 |
-
attn_implementation = sdpa
|
| 137 |
-
block_size = 8
|
| 138 |
-
denoising_steps = 8
|
| 139 |
-
```
|
| 140 |
-
|
| 141 |
---
|
| 142 |
|
| 143 |
## π Inference Example
|
|
@@ -213,8 +199,6 @@ response_ids = model.generate(
|
|
| 213 |
print(processor.tokenizer.batch_decode(response_ids, skip_special_tokens=True)[0].strip())
|
| 214 |
```
|
| 215 |
|
| 216 |
-
For video understanding, replace the image message with the video example in `inference.py`.
|
| 217 |
-
|
| 218 |
---
|
| 219 |
|
| 220 |
## π Citation
|
|
|
|
| 74 |
## π§ Method Structure
|
| 75 |
|
| 76 |
<p align="center">
|
| 77 |
+
<img src="./model.PNG" alt="Bard-VL method overview" width="80%">
|
| 78 |
</p>
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
## π Evaluation Results
|
| 82 |
|
|
|
|
| 124 |
deepspeed==0.17.0
|
| 125 |
```
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
---
|
| 128 |
|
| 129 |
## π Inference Example
|
|
|
|
| 199 |
print(processor.tokenizer.batch_decode(response_ids, skip_special_tokens=True)[0].strip())
|
| 200 |
```
|
| 201 |
|
|
|
|
|
|
|
| 202 |
---
|
| 203 |
|
| 204 |
## π Citation
|