Downloads · 30 days
23
11% of all-time downloads
rahilsinghi/firstsight-qwen2-vl-2b-distilled
firstsight-qwen2-vl-2b-distilled is a machine learning model from rahilsinghi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
FirstSight is a knowledge-distilled vision-language model optimized for efficient egocentric question answering on edge devices. This model is distilled from Qwen2-VL-7B-Instruct using advanced distillation techniques…
Downloads · 30 days
23
11% of all-time downloads
All-time downloads
201
Public
Parameters
2.2B
4.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors4.4 GB · 100%
From the Hugging Face model README
FirstSight is a knowledge-distilled vision-language model optimized for efficient egocentric question answering on edge devices. This model is distilled from Qwen2-VL-7B-Instruct using advanced distillation techniques, achieving 3.75× compression with minimal performance degradation.
{
"learning_rate": 1e-5,
"optimizer": "AdamW",
"weight_decay": 0.01,
"gradient_accumulation_steps": 4,
"max_grad_norm": 1.0,
"warmup_steps": 100,
"temperature": 2.0,
"alpha": 0.7,
"epochs": 10
}
| Metric | Teacher (7B) | Student (2B) | Improvement |
|---|---|---|---|
| Avg Latency | 1.260s | 0.244s | 5.16× |
| Throughput (samples/s) | 0.79 | 4.10 | 5.16× |
| Throughput (tokens/s) | 34.33 | 162.55 | 5.16× |
| Metric | Teacher (7B) | Student (2B) | Savings |
|---|---|---|---|
| Model Size | 8.29B params | 2.21B params | 73.4% |
| Peak VRAM | 13.81 GB | 4.43 GB | 9.39 GB |
| VRAM Reduction | - | - | 67.9% |
pip install transformers torch pillow qwen-vl-utils
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
from PIL import Image
import torch
# Load model and processor
model_name = "YOUR_USERNAME/firstsight-qwen2-vl-2b-distilled"
model = Qwen2VLForConditionalGeneration.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
processor = AutoProcessor.from_pretrained(model_name)
# Prepare image and question
image = Image.open("egocentric_image.jpg")
question = "What object am I holding in my right hand?"
# Create conversation template
messages = [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": f"Question: {question}\nAnswer concisely:"}
]
}
]
# Prepare inputs
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt", padding=True)
inputs = inputs.to(model.device)
# Generate answer
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=128,
do_sample=False
)
# Decode response
response = processor.batch_decode(
outputs[:, inputs['input_ids'].shape[1]:],
skip_special_tokens=True,
clean_up_tokenization_spaces=False
)[0]
print(f"Answer: {response}")
If you use this model in your research, please cite:
@misc{firstsight2024,
title={FirstSight: Efficient Knowledge Distillation for Vision-Language Models on Edge Devices},
author={NYU HPML Project Team},
year={2024},
howpublished={\url{https://huggingface.co/YOUR_USERNAME/firstsight-qwen2-vl-2b-distilled}},
note={Distilled from Qwen2-VL-7B-Instruct for egocentric question answering}
}
NYU High Performance Machine Learning (HPML) Project Team
For questions or feedback, please open an issue on the GitHub repository.
Training Date: December 8-9, 2024
Evaluation Date: 2025-12-09T00:32:52.669538
Framework: PyTorch 2.3.0, Transformers 4.57.3, BitsAndBytes 0.48.2