Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

fudan-generative-ai
/
Bard-VL-B4-Mask-2B-Instruct

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
Model card Files Files and versions
xet
Community
6

Instructions to use fudan-generative-ai/Bard-VL-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-Instruct", trust_remote_code=True, dtype="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • vLLM

    How to use fudan-generative-ai/Bard-VL-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-Instruct
  • SGLang

    How to use fudan-generative-ai/Bard-VL-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-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-B4-Mask-2B-Instruct with Docker Model Runner:

    docker model run hf.co/fudan-generative-ai/Bard-VL-B4-Mask-2B-Instruct
Bard-VL-B4-Mask-2B-Instruct
4.27 GB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 4 commits
merryyuan's picture
merryyuan
Upload model.PNG
91c7734 verified 14 days ago
  • .gitattributes
    1.57 kB
    Upload model.PNG 14 days ago
  • README.md
    7.51 kB
    Create README.md (#2) 14 days ago
  • chat_template.json
    5.5 kB
    Upload folder using huggingface_hub 17 days ago
  • config.json
    1.5 kB
    Upload folder using huggingface_hub 17 days ago
  • config.yaml
    1.81 kB
    Upload folder using huggingface_hub 17 days ago
  • generation_config.json
    269 Bytes
    Upload folder using huggingface_hub 17 days ago
  • merges.txt
    1.67 MB
    Upload folder using huggingface_hub 17 days ago
  • model.PNG
    537 kB
    xet
    Upload model.PNG 14 days ago
  • model.safetensors
    4.26 GB
    xet
    Upload folder using huggingface_hub 17 days ago
  • preprocessor_config.json
    389 Bytes
    Upload folder using huggingface_hub 17 days ago
  • tokenizer.json
    7.03 MB
    Upload folder using huggingface_hub 17 days ago
  • tokenizer_config.json
    10.9 kB
    Upload folder using huggingface_hub 17 days ago
  • video_preprocessor_config.json
    385 Bytes
    Upload folder using huggingface_hub 17 days ago
  • vocab.json
    2.78 MB
    Upload folder using huggingface_hub 17 days ago