Instructions to use demo-at-wsld-8/blip-at-wsld-fashion200k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use demo-at-wsld-8/blip-at-wsld-fashion200k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="demo-at-wsld-8/blip-at-wsld-fashion200k")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("demo-at-wsld-8/blip-at-wsld-fashion200k") model = AutoModelForMultimodalLM.from_pretrained("demo-at-wsld-8/blip-at-wsld-fashion200k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use demo-at-wsld-8/blip-at-wsld-fashion200k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "demo-at-wsld-8/blip-at-wsld-fashion200k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "demo-at-wsld-8/blip-at-wsld-fashion200k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/demo-at-wsld-8/blip-at-wsld-fashion200k
- SGLang
How to use demo-at-wsld-8/blip-at-wsld-fashion200k 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 "demo-at-wsld-8/blip-at-wsld-fashion200k" \ --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": "demo-at-wsld-8/blip-at-wsld-fashion200k", "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 "demo-at-wsld-8/blip-at-wsld-fashion200k" \ --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": "demo-at-wsld-8/blip-at-wsld-fashion200k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use demo-at-wsld-8/blip-at-wsld-fashion200k with Docker Model Runner:
docker model run hf.co/demo-at-wsld-8/blip-at-wsld-fashion200k
Use Docker
docker model run hf.co/demo-at-wsld-8/blip-at-wsld-fashion200kBLIP-base distilled (Attention Transfer + WSLD) — Fashion-200k captioning
Student model distill từ Salesforce/blip-image-captioning-large (Teacher) sang
Salesforce/blip-image-captioning-base đã prune decoder (12 → 4 tầng), train trên
Fashion-200k bằng combined loss:
- Attention Transfer (AT) ở vision encoder — so khớp attention map giữa Student/Teacher.
- WSLD (Weighted Soft Label Distillation) ở decoder — soft loss có trọng số theo token.
- Cross-entropy với ground-truth caption.
Kiến trúc
- Tham số: 148.4M | Kích thước: 283.0MB
- Decoder giữ lại tầng: [0, 3, 6, 9]
Kết quả trên test set
{ "BLEU-4": 0.2458812827818811, "BLEU-1": 0.6297635645404903, "ROUGE-1": 0.5509984919361472, "ROUGE-2": 0.33081984865850167, "ROUGE-L": 0.4506778285021464, "METEOR": 0.40850410599132086, "CIDEr": 0.6211192626331922 }
Cách dùng
from huggingface_hub import hf_hub_download
from transformers import BlipForConditionalGeneration, BlipProcessor
import torch, json
repo_id = "demo-at-wsld-8/blip-at-wsld-fashion200k"
cfg = json.load(open(hf_hub_download(repo_id, "deploy_config.json"), encoding="utf-8"))
ckpt = hf_hub_download(repo_id, "student_at_wsld.pth")
# xem code dung lai kien truc (prune_decoder_layers, fix_decoder_layer_idx) trong app.py cua Space demo
Code training đầy đủ
Xem notebook Kaggle: https://www.kaggle.com/code/anhvunguyenquynh/at-wsld
- Downloads last month
- 60
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "demo-at-wsld-8/blip-at-wsld-fashion200k"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "demo-at-wsld-8/blip-at-wsld-fashion200k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'