Image-Text-to-Text
Transformers
Safetensors
lfm2_vl
liquid
lfm2.5
edge
decision
classification
calibration
system-one
multimodal
decision-model
conversational
custom_code
4-bit precision
auto-round
Instructions to use Vishva007/d1-3B-W4A16-AutoRound with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vishva007/d1-3B-W4A16-AutoRound with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Vishva007/d1-3B-W4A16-AutoRound", trust_remote_code=True) 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("Vishva007/d1-3B-W4A16-AutoRound", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("Vishva007/d1-3B-W4A16-AutoRound", trust_remote_code=True, 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 Vishva007/d1-3B-W4A16-AutoRound with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Vishva007/d1-3B-W4A16-AutoRound" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vishva007/d1-3B-W4A16-AutoRound", "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/Vishva007/d1-3B-W4A16-AutoRound
- SGLang
How to use Vishva007/d1-3B-W4A16-AutoRound 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 "Vishva007/d1-3B-W4A16-AutoRound" \ --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": "Vishva007/d1-3B-W4A16-AutoRound", "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 "Vishva007/d1-3B-W4A16-AutoRound" \ --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": "Vishva007/d1-3B-W4A16-AutoRound", "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 Vishva007/d1-3B-W4A16-AutoRound with Docker Model Runner:
docker model run hf.co/Vishva007/d1-3B-W4A16-AutoRound
|
Download README.md from Vishva007/d1-3B-W4A16-AutoRound: direct link, hf CLI and curl.
- Browser
- Download file 6.39 kB
-
https://huggingface.co/Vishva007/d1-3B-W4A16-AutoRound/resolve/main/README.md
- Command line
-
hf download hf://Vishva007/d1-3B-W4A16-AutoRound/README.md
-
curl -L -o README.md https://huggingface.co/Vishva007/d1-3B-W4A16-AutoRound/resolve/main/README.md
6.39 kB
| library_name: transformers | |
| license: other | |
| license_name: lfm1.0 | |
| license_link: LICENSE | |
| language: | |
| - ar | |
| - zh | |
| - en | |
| - fr | |
| - de | |
| - hi | |
| - id | |
| - it | |
| - ja | |
| - ko | |
| - pl | |
| - pt | |
| - ru | |
| - es | |
| - th | |
| - vi | |
| pipeline_tag: image-text-to-text | |
| base_model: | |
| - LiquidAI/d1-3B | |
| tags: | |
| - liquid | |
| - lfm2.5 | |
| - edge | |
| - decision | |
| - classification | |
| - calibration | |
| - system-one | |
| - multimodal | |
| - decision-model | |
| # d1-3B-W4A16-AutoRound | |
| This repository contains a **4-bit W4A16** quantized version of [LiquidAI/d1-3B](https://huggingface.co/LiquidAI/d1-3B), optimized using [AutoRound](https://github.com/intel/auto-round). | |
| `d1-3B` is a multimodal decision model built on `LFM2.5-VL-3B`. It evaluates states (text, images, or JSON) against typed questions in a single forward pass with zero autoregressive output tokens. | |
| ## Quantization Details | |
| - **Method:** AutoRound (`W4A16`) | |
| - **Group Size:** 32 (`group_size=32`, `sym=True`) | |
| - **Calibration:** 512 samples, 800 tuning iterations, sequence length 2048 | |
| - **Vision Tower:** Retained in unquantized precision (`quant_nontext_module=False`) to preserve full visual feature fidelity | |
| - **Format:** Compatible with `auto_round` and AutoGPTQ backends | |
| --- | |
| ## Quickstart | |
| ### Installation | |
| ```bash | |
| pip install --upgrade "transformers>=5.14" torch torchvision pillow auto-round | |
| # Optional for optimized kernels: | |
| pip install auto-round-lib | |
| ``` | |
| ### Inference Example | |
| ```python | |
| import torch | |
| from transformers import AutoModel | |
| from transformers.image_utils import load_image | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32 | |
| # Load quantized model | |
| model = AutoModel.from_pretrained( | |
| "Vishva007/d1-3B-W4A16-AutoRound", | |
| trust_remote_code=True, | |
| dtype=dtype, | |
| device_map="auto" | |
| ) | |
| # 1. Text Classification / Decision | |
| questions = { | |
| "refund": { | |
| "type": "noul", | |
| "instructions": "Is the customer asking for a refund?", | |
| }, | |
| "team": { | |
| "type": "choice", | |
| "instructions": "Which team should handle this?", | |
| "criteria": { | |
| "billing": "Charges, refunds, invoices", | |
| "technical": "App or site faults", | |
| "fraud": "Suspected unauthorised use", | |
| }, | |
| }, | |
| } | |
| prompt = "I was charged twice this month, please refund one of them." | |
| res_text = model.system_one(prompt, questions) | |
| print("Text Decision:", res_text) | |
| # 2. Multimodal / Image Evaluation | |
| image = load_image("[http://images.cocodataset.org/val2017/000000039769.jpg](http://images.cocodataset.org/val2017/000000039769.jpg)") | |
| cats_q = { | |
| "type": "choice", | |
| "instructions": "How many cats are there?", | |
| "criteria": {"one": "One", "two": "Two", "more": "Three or more"}, | |
| } | |
| res_image = model.system_one(None, {"cats": cats_q}, images=[image]) | |
| print("Vision Decision:", res_image) | |
| ``` | |
| --- | |
| ## Intended Use | |
| * Single-pass decision classification (Yes/No `noul`, multi-choice `choice`, and calibrated scales `score`) | |
| * Triage, routing, intent detection, content moderation, agent safety guards | |
| * Zero-token generation latency overhead at reduced VRAM footprint | |
| --- | |
| ### 🚀 Deploy on RunPod | |
| One-click launch environments pre-configured with PyTorch, CUDA, and dependencies for fine-tuning or quantization. | |
| > 🎁 **Need GPU compute?** Sign up via [RunPod](https://runpod.io?ref=iabrlp7z) and get **$5–$500 in free credits** when you add your first $10. | |
| #### PyTorch 2.14 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.14 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.14-runpod` | `d7lxsa4w9m` | [](https://runpod.io/console/deploy?template=d7lxsa4w9m&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.14-runpod` | `yk0y6j6rpg` | [](https://runpod.io/console/deploy?template=yk0y6j6rpg&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.14-runpod` | `gsp4gwx0nw` | [](https://runpod.io/console/deploy?template=gsp4gwx0nw&ref=iabrlp7z) | | |
| #### PyTorch 2.13 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.13 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.13-runpod` | `gmlupxnxfk` | [](https://runpod.io/console/deploy?template=gmlupxnxfk&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.13-runpod` | `y3j8xvk4f4` | [](https://runpod.io/console/deploy?template=y3j8xvk4f4&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.13-runpod` | `vigpissn5w` | [](https://runpod.io/console/deploy?template=vigpissn5w&ref=iabrlp7z) | | |
| #### PyTorch 2.12 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.12 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.12-runpod` | `ctmz86zmf0` | [](https://runpod.io/console/deploy?template=ctmz86zmf0&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.12-runpod` | `qjko5yiwzi` | [](https://runpod.io/console/deploy?template=qjko5yiwzi&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.12-runpod` | `ifg6xmye0f` | [](https://runpod.io/console/deploy?template=ifg6xmye0f&ref=iabrlp7z) | | |
| --- | |
| ## Acknowledgements | |
| * Base model by [Liquid AI](https://huggingface.co/LiquidAI). | |
| * Quantized using Intel's [AutoRound](https://github.com/intel/auto-round). |