Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
decision-making
classification
calibration
routing
guardrails
agents
games
on-device
system-one
jev
image-input
conversational
Instructions to use labqoat/qev-0.8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use labqoat/qev-0.8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="labqoat/qev-0.8b") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("labqoat/qev-0.8b") model = AutoModelForMultimodalLM.from_pretrained("labqoat/qev-0.8b", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use labqoat/qev-0.8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "labqoat/qev-0.8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "labqoat/qev-0.8b", "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/labqoat/qev-0.8b
- SGLang
How to use labqoat/qev-0.8b 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 "labqoat/qev-0.8b" \ --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": "labqoat/qev-0.8b", "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 "labqoat/qev-0.8b" \ --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": "labqoat/qev-0.8b", "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 labqoat/qev-0.8b with Docker Model Runner:
docker model run hf.co/labqoat/qev-0.8b
qev_fast vision: fix KeyError when a full image cache evicts an image the same call uses
Browse files- SHA256SUMS +1 -1
- qev_fast/vision.py +13 -5
SHA256SUMS
CHANGED
|
@@ -21,7 +21,7 @@ ed65a44a68aefcc6397068db52274433cd372a2c5fff6b1f7f901ef543429941 qev_fast/engin
|
|
| 21 |
e9a6ef607a94a11f659f4d57fa1588c8b99b5288535ed9fb7db0a144fd817c55 qev_fast/prefix.py
|
| 22 |
c849a299772c7186b5b30feb9db777ef12673271e739051ce0968f6bbc741b27 qev_fast/runner.py
|
| 23 |
9a7e7a159b4b6c9c1755ccbaf6c11b433bac78f8ec67474833e61821d77999ef qev_fast/systemone.py
|
| 24 |
-
|
| 25 |
e8d061404d312ca2cfbec5db8d5adbacb9fd2888e20997833f8080ed317e4184 qev_image.py
|
| 26 |
1cfc5fbdc1b4317bd2df8f2e965ee466f95a33af5db8c949d157f86c93996d4e qev_image_server.py
|
| 27 |
01239024d6bce903ae16a8bda08a56b6ecbf43d630b9bd590fb1a73e9c11e54c qev_server.py
|
|
|
|
| 21 |
e9a6ef607a94a11f659f4d57fa1588c8b99b5288535ed9fb7db0a144fd817c55 qev_fast/prefix.py
|
| 22 |
c849a299772c7186b5b30feb9db777ef12673271e739051ce0968f6bbc741b27 qev_fast/runner.py
|
| 23 |
9a7e7a159b4b6c9c1755ccbaf6c11b433bac78f8ec67474833e61821d77999ef qev_fast/systemone.py
|
| 24 |
+
3713ce5af6d548cd5db324feae5d31f99379ddb21c544d3cc0bad98939ad159a qev_fast/vision.py
|
| 25 |
e8d061404d312ca2cfbec5db8d5adbacb9fd2888e20997833f8080ed317e4184 qev_image.py
|
| 26 |
1cfc5fbdc1b4317bd2df8f2e965ee466f95a33af5db8c949d157f86c93996d4e qev_image_server.py
|
| 27 |
01239024d6bce903ae16a8bda08a56b6ecbf43d630b9bd590fb1a73e9c11e54c qev_server.py
|
qev_fast/vision.py
CHANGED
|
@@ -105,19 +105,27 @@ class Vision:
|
|
| 105 |
seen.add(p.key)
|
| 106 |
self.stats["images"] += len(preps)
|
| 107 |
self.stats["cache_hits"] += len(preps) - len(todo)
|
|
|
|
| 108 |
if todo:
|
| 109 |
pix = torch.cat([p.pix for p in todo]).to(self.device, self.visual.dtype)
|
| 110 |
thw = torch.cat([p.thw for p in todo]).to(self.device)
|
| 111 |
out = self.visual(pix, grid_thw=thw, return_dict=True).pooler_output
|
| 112 |
self.stats["tower_calls"] += 1
|
| 113 |
for p, e in zip(todo, torch.split(out, [p.n for p in todo]), strict=True):
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
res = []
|
| 118 |
for p in preps:
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
return res
|
| 122 |
|
| 123 |
def positions(self, ids: list, preps: list) -> np.ndarray:
|
|
|
|
| 105 |
seen.add(p.key)
|
| 106 |
self.stats["images"] += len(preps)
|
| 107 |
self.stats["cache_hits"] += len(preps) - len(todo)
|
| 108 |
+
fresh = {}
|
| 109 |
if todo:
|
| 110 |
pix = torch.cat([p.pix for p in todo]).to(self.device, self.visual.dtype)
|
| 111 |
thw = torch.cat([p.thw for p in todo]).to(self.device)
|
| 112 |
out = self.visual(pix, grid_thw=thw, return_dict=True).pooler_output
|
| 113 |
self.stats["tower_calls"] += 1
|
| 114 |
for p, e in zip(todo, torch.split(out, [p.n for p in todo]), strict=True):
|
| 115 |
+
fresh[p.key] = e
|
| 116 |
+
# Read every embedding of this call before the cache is trimmed: trimming can evict a cached image this same
|
| 117 |
+
# call uses (a full cache, one cached and one new image), and a call can hold more images than the cache.
|
| 118 |
res = []
|
| 119 |
for p in preps:
|
| 120 |
+
e = fresh.get(p.key)
|
| 121 |
+
if e is None:
|
| 122 |
+
e = self.cache[p.key]
|
| 123 |
+
self.cache.move_to_end(p.key)
|
| 124 |
+
res.append(e)
|
| 125 |
+
for k, e in fresh.items():
|
| 126 |
+
self.cache[k] = e
|
| 127 |
+
while len(self.cache) > self.cache_size:
|
| 128 |
+
self.cache.popitem(last=False)
|
| 129 |
return res
|
| 130 |
|
| 131 |
def positions(self, ids: list, preps: list) -> np.ndarray:
|