Image-Text-to-Text
Transformers
Safetensors
qwen3_5
decision-making
routing
mixture-of-experts
moqle
lora
agents
e2e-testing
games
multilingual
on-device
system-one
conversational
Instructions to use labqoat/squad-0.8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use labqoat/squad-0.8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="labqoat/squad-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/squad-0.8b") model = AutoModelForMultimodalLM.from_pretrained("labqoat/squad-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/squad-0.8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "labqoat/squad-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/squad-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/squad-0.8b
- SGLang
How to use labqoat/squad-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/squad-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/squad-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/squad-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/squad-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/squad-0.8b with Docker Model Runner:
docker model run hf.co/labqoat/squad-0.8b
Download qev_image_server.py from labqoat/squad-0.8b: direct link, hf CLI and curl.
- Browser
- Download file 5.04 kB
-
https://huggingface.co/labqoat/squad-0.8b/resolve/main/qev_image_server.py
- Command line
-
hf download hf://labqoat/squad-0.8b/qev_image_server.py
-
curl -L -o qev_image_server.py https://huggingface.co/labqoat/squad-0.8b/resolve/main/qev_image_server.py
5.04 kB
| """qev_image_server: a local System One HTTP server with images (qev_server.py's protocol plus an "images" field). | |
| python qev_image_server.py --model labqoat/squad-0.8b --port 8018 | |
| curl http://127.0.0.1:8018/v1/systemone -H 'Content-Type: application/json' -d '{ | |
| "state": "Customer screenshot: <image:shot>", | |
| "images": {"shot": "<base64 of a PNG or JPEG>"}, | |
| "questions": {"err": {"type": "noul", "instructions": "Does the screenshot show an error dialog?"}}}' | |
| The request format is the System One one of qev_server.py plus an optional "images": {name: base64 string} object | |
| (a data: URL prefix is accepted). The state references an image with "<image:name>"; an image the state does not | |
| mention is appended to the context. The answer has the same shape as qev_server.py's, with | |
| "usage": {"input_tokens", "image_tokens", "output_tokens": 0}. Requests are serialised on one model (no | |
| micro-batching here). Request validation and the Server class come from qev_server.py, unchanged. | |
| """ | |
| import argparse | |
| import base64 | |
| import binascii | |
| import io | |
| import json | |
| import os | |
| import sys | |
| import threading | |
| import time | |
| from http.server import BaseHTTPRequestHandler | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| sys.path.insert(0, HERE) # qev_server.py and qev_image.py sit next to this file in the qev-0.8b repo | |
| from qev_server import MAX_BODY, Server, _validate # noqa: E402 | |
| from qev_image import QEVImage # noqa: E402 | |
| def decode_images(raw) -> dict: | |
| from PIL import Image | |
| if raw is None: | |
| return {} | |
| if not isinstance(raw, dict): | |
| raise ValueError('"images" must be an object {name: base64 string}') | |
| out = {} | |
| for k, v in raw.items(): | |
| if not isinstance(v, str): | |
| raise ValueError(f'image "{k}": a base64 string') | |
| if v.startswith("data:"): | |
| v = v.split(",", 1)[-1] | |
| try: | |
| out[k] = Image.open(io.BytesIO(base64.b64decode(v, validate=True))).convert("RGB") | |
| except (binascii.Error, OSError) as e: | |
| raise ValueError(f'image "{k}": not a decodable base64 image ({e})') from None | |
| return out | |
| def make_handler(m: QEVImage, info: dict): | |
| lock = threading.Lock() | |
| class H(BaseHTTPRequestHandler): | |
| protocol_version = "HTTP/1.1" | |
| def _send(self, code, body): | |
| data = json.dumps(body, ensure_ascii=False).encode() | |
| self.send_response(code) | |
| self.send_header("Content-Type", "application/json") | |
| self.send_header("Content-Length", str(len(data))) | |
| self.end_headers() | |
| self.wfile.write(data) | |
| def log_message(self, fmt, *args): | |
| pass | |
| def do_GET(self): | |
| if self.path.split("?")[0] == "/health": | |
| return self._send(200, {"status": "ok", **info}) | |
| return self._send(404, {"detail": "not found"}) | |
| def do_POST(self): | |
| if self.path.split("?")[0] != "/v1/systemone": | |
| return self._send(404, {"detail": "not found"}) | |
| try: | |
| n = int(self.headers.get("Content-Length", 0)) | |
| if n > MAX_BODY: | |
| return self._send(413, {"detail": f"the body is larger than {MAX_BODY} bytes"}) | |
| body = json.loads(self.rfile.read(n) or b"{}") | |
| state, qs, _ = _validate(body) | |
| imgs = decode_images(body.get("images")) | |
| except (ValueError, json.JSONDecodeError) as e: | |
| return self._send(422, {"detail": str(e)}) | |
| t = time.perf_counter() | |
| try: | |
| with lock: | |
| (ans, toks, itoks), = m.decide_batch([(state, qs, imgs)], usage=True) | |
| except (ValueError, KeyError, TypeError, AssertionError) as e: | |
| return self._send(422, {"detail": str(e) or type(e).__name__}) | |
| except Exception as e: # noqa: BLE001 | |
| return self._send(500, {"detail": f"{type(e).__name__}: {e}"}) | |
| return self._send(200, {"model": info["model"], "answers": ans, | |
| "usage": {"input_tokens": toks, "image_tokens": itoks, "output_tokens": 0}, | |
| "latency_ms": round((time.perf_counter() - t) * 1000, 2)}) | |
| return H | |
| def main(): | |
| ap = argparse.ArgumentParser(description="qev-0.8b System One server with images (local)") | |
| ap.add_argument("--model", required=True) | |
| ap.add_argument("--host", default="127.0.0.1") | |
| ap.add_argument("--port", type=int, default=8018) | |
| ap.add_argument("--max-pixels", type=int, default=448 * 448) | |
| ap.add_argument("--device", default=None) | |
| a = ap.parse_args() | |
| m = QEVImage.from_pretrained(a.model, device=a.device, max_pixels=a.max_pixels) | |
| info = {"model": "qev-0.8b-image", "max_pixels": a.max_pixels, "device": str(m.device)} | |
| srv = Server((a.host, a.port), make_handler(m, info)) | |
| print(f"qev_image_server on http://{a.host}:{a.port}", flush=True) | |
| srv.serve_forever() | |
| if __name__ == "__main__": | |
| main() | |