Image-Text-to-Text
Transformers
Safetensors
lfm3_vl
feature-extraction
liquid
lfm3
edge
decision
classification
extraction
calibration
system-one
multimodal
decision-model
custom_code
conversational
Instructions to use LiquidAI/d1-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/d1-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="LiquidAI/d1-2B", 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 AutoModel model = AutoModel.from_pretrained("LiquidAI/d1-2B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LiquidAI/d1-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/d1-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/d1-2B", "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/LiquidAI/d1-2B
- SGLang
How to use LiquidAI/d1-2B 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 "LiquidAI/d1-2B" \ --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": "LiquidAI/d1-2B", "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 "LiquidAI/d1-2B" \ --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": "LiquidAI/d1-2B", "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 LiquidAI/d1-2B with Docker Model Runner:
docker model run hf.co/LiquidAI/d1-2B
Download calibration.json from LiquidAI/d1-2B: direct link, hf CLI and curl.
- Browser
- Download file 4.92 kB
-
https://huggingface.co/LiquidAI/d1-2B/resolve/main/calibration.json
- Command line
-
hf download hf://LiquidAI/d1-2B/calibration.json
-
curl -L -o calibration.json https://huggingface.co/LiquidAI/d1-2B/resolve/main/calibration.json
4.92 kB
| { | |
| "default": 1.337398453966105, | |
| "temperatures": {}, | |
| "tables": { | |
| "found:text": [ | |
| [ | |
| 0.005682162615729877, | |
| 0.0 | |
| ], | |
| [ | |
| 0.020574209407310595, | |
| 0.011363636363636364 | |
| ], | |
| [ | |
| 0.05274184431288053, | |
| 0.022727272727272728 | |
| ], | |
| [ | |
| 0.12593568082560191, | |
| 0.11363636363636363 | |
| ], | |
| [ | |
| 0.2609023091129281, | |
| 0.25 | |
| ], | |
| [ | |
| 0.45711776140061294, | |
| 0.42045454545454547 | |
| ], | |
| [ | |
| 0.6460263153368776, | |
| 0.5568181818181818 | |
| ], | |
| [ | |
| 0.7728411636569283, | |
| 0.7727272727272727 | |
| ], | |
| [ | |
| 0.852111120115627, | |
| 0.8522727272727273 | |
| ], | |
| [ | |
| 0.9055508368394591, | |
| 0.9204545454545454 | |
| ], | |
| [ | |
| 0.9416752389886163, | |
| 0.9318181818181818 | |
| ], | |
| [ | |
| 0.9675597308034246, | |
| 0.9772727272727273 | |
| ], | |
| [ | |
| 0.9927885918454691, | |
| 0.9924242424242424 | |
| ], | |
| [ | |
| 0.9997205003886156, | |
| 1.0 | |
| ] | |
| ], | |
| "found:number": [ | |
| [ | |
| 0.01582507598356401, | |
| 0.0 | |
| ], | |
| [ | |
| 0.1465578345315797, | |
| 0.2857142857142857 | |
| ], | |
| [ | |
| 0.29448616611106054, | |
| 0.5 | |
| ], | |
| [ | |
| 0.6300800165959767, | |
| 0.7142857142857143 | |
| ], | |
| [ | |
| 0.9313231366021293, | |
| 0.9285714285714286 | |
| ], | |
| [ | |
| 0.9951998972501911, | |
| 1.0 | |
| ] | |
| ], | |
| "found:date": [ | |
| [ | |
| 0.008417200646363199, | |
| 0.0 | |
| ], | |
| [ | |
| 0.5494083234419426, | |
| 0.5 | |
| ], | |
| [ | |
| 0.9654906044403712, | |
| 0.9166666666666666 | |
| ], | |
| [ | |
| 0.9966836659113566, | |
| 1.0 | |
| ] | |
| ], | |
| "found:box": [ | |
| [ | |
| 0.0010319100776659475, | |
| 0.0027472527472527475 | |
| ], | |
| [ | |
| 0.0162678323005357, | |
| 0.11235955056179775 | |
| ], | |
| [ | |
| 0.1641463061831407, | |
| 0.4157303370786517 | |
| ], | |
| [ | |
| 0.6041711138630492, | |
| 0.8541666666666666 | |
| ], | |
| [ | |
| 0.8735690557675277, | |
| 0.978021978021978 | |
| ], | |
| [ | |
| 0.9579824398960495, | |
| 0.9887640449438202 | |
| ], | |
| [ | |
| 0.9952215192477699, | |
| 1.0 | |
| ] | |
| ], | |
| "box": [ | |
| [ | |
| 0.08177083333333333, | |
| 0.18333333333333332 | |
| ], | |
| [ | |
| 0.35257161458333336, | |
| 0.4 | |
| ], | |
| [ | |
| 0.5962035123966942, | |
| 0.6694214876033058 | |
| ], | |
| [ | |
| 0.7902631915983607, | |
| 0.7786885245901639 | |
| ], | |
| [ | |
| 0.8755763319672131, | |
| 0.8688524590163934 | |
| ], | |
| [ | |
| 0.9086263020833333, | |
| 0.9 | |
| ], | |
| [ | |
| 0.9435433650362319, | |
| 0.9492753623188406 | |
| ], | |
| [ | |
| 0.9652183219178082, | |
| 0.9726027397260274 | |
| ], | |
| [ | |
| 0.9831365659916201, | |
| 0.9888268156424581 | |
| ], | |
| [ | |
| 0.9948308270676691, | |
| 1.0 | |
| ] | |
| ], | |
| "estimate": [ | |
| [ | |
| 0.030000000000000002, | |
| 0.22420634920634921 | |
| ], | |
| [ | |
| 0.09, | |
| 0.28869047619047616 | |
| ], | |
| [ | |
| 0.15000000000000002, | |
| 0.3551587301587302 | |
| ], | |
| [ | |
| 0.21000000000000002, | |
| 0.4007936507936508 | |
| ], | |
| [ | |
| 0.27, | |
| 0.4603174603174603 | |
| ], | |
| [ | |
| 0.32999999999999996, | |
| 0.5238095238095238 | |
| ], | |
| [ | |
| 0.39, | |
| 0.5922619047619048 | |
| ], | |
| [ | |
| 0.44999999999999996, | |
| 0.6448412698412699 | |
| ], | |
| [ | |
| 0.51, | |
| 0.7033730158730159 | |
| ], | |
| [ | |
| 0.57, | |
| 0.7579365079365079 | |
| ], | |
| [ | |
| 0.63, | |
| 0.7986111111111112 | |
| ], | |
| [ | |
| 0.69, | |
| 0.8452380952380952 | |
| ], | |
| [ | |
| 0.75, | |
| 0.8869047619047619 | |
| ], | |
| [ | |
| 0.81, | |
| 0.9246031746031746 | |
| ], | |
| [ | |
| 0.87, | |
| 0.9523809523809523 | |
| ], | |
| [ | |
| 0.93, | |
| 0.9751984126984127 | |
| ], | |
| [ | |
| 0.9799999999999999, | |
| 0.9940476190476191 | |
| ] | |
| ], | |
| "multiple": [ | |
| [ | |
| 0.0016627926872626571, | |
| 0.0 | |
| ], | |
| [ | |
| 0.008286236297705318, | |
| 0.0024813895781637717 | |
| ], | |
| [ | |
| 0.013284336191710702, | |
| 0.0049504950495049506 | |
| ], | |
| [ | |
| 0.017877624036637375, | |
| 0.015 | |
| ], | |
| [ | |
| 0.023793328700436385, | |
| 0.018518518518518517 | |
| ], | |
| [ | |
| 0.03199311782995977, | |
| 0.03398058252427184 | |
| ], | |
| [ | |
| 0.04889508202323689, | |
| 0.05459057071960298 | |
| ], | |
| [ | |
| 0.07631002315865278, | |
| 0.07407407407407407 | |
| ], | |
| [ | |
| 0.10610537429711313, | |
| 0.1262135922330097 | |
| ], | |
| [ | |
| 0.1516745984883731, | |
| 0.15865384615384615 | |
| ], | |
| [ | |
| 0.2304679394076778, | |
| 0.21393034825870647 | |
| ], | |
| [ | |
| 0.374861408323991, | |
| 0.3417085427135678 | |
| ], | |
| [ | |
| 0.6689872755703948, | |
| 0.7 | |
| ], | |
| [ | |
| 0.976994335126831, | |
| 0.9690721649484536 | |
| ] | |
| ], | |
| "found:boxes": [ | |
| [ | |
| 0.0022886859880368398, | |
| 0.0 | |
| ], | |
| [ | |
| 0.11311487904813239, | |
| 0.0891089108910891 | |
| ], | |
| [ | |
| 0.39857997008840157, | |
| 0.3786407766990291 | |
| ], | |
| [ | |
| 0.8182158553298949, | |
| 0.8514851485148515 | |
| ], | |
| [ | |
| 0.980104905128495, | |
| 0.9702970297029703 | |
| ], | |
| [ | |
| 0.9981022046260327, | |
| 1.0 | |
| ] | |
| ], | |
| "boxes": [ | |
| [ | |
| 0.00048828125, | |
| 0.0 | |
| ], | |
| [ | |
| 0.008246527777777778, | |
| 0.05555555555555555 | |
| ], | |
| [ | |
| 0.0777587890625, | |
| 0.3125 | |
| ], | |
| [ | |
| 0.20135498046875, | |
| 0.46875 | |
| ], | |
| [ | |
| 0.3692626953125, | |
| 0.5625 | |
| ], | |
| [ | |
| 0.50830078125, | |
| 0.625 | |
| ], | |
| [ | |
| 0.5980224609375, | |
| 0.6875 | |
| ], | |
| [ | |
| 0.6732177734375, | |
| 0.8125 | |
| ], | |
| [ | |
| 0.8321126302083334, | |
| 0.9375 | |
| ], | |
| [ | |
| 0.9644757699275363, | |
| 0.9710144927536232 | |
| ], | |
| [ | |
| 0.9945746527777778, | |
| 1.0 | |
| ] | |
| ] | |
| } | |
| } | |