--- license: apache-2.0 language: vi library_name: transformers tags: - image-captioning - knowledge-distillation - blip - fashion --- # BLIP-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 ```python 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