Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
OCR
unsloth
pdf2markdown
conversational
text-generation-inference
4-bit precision
awq
Instructions to use JoshuaWong/Nanonets-OCR-s-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JoshuaWong/Nanonets-OCR-s-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="JoshuaWong/Nanonets-OCR-s-AWQ") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("JoshuaWong/Nanonets-OCR-s-AWQ") model = AutoModelForMultimodalLM.from_pretrained("JoshuaWong/Nanonets-OCR-s-AWQ", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JoshuaWong/Nanonets-OCR-s-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JoshuaWong/Nanonets-OCR-s-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JoshuaWong/Nanonets-OCR-s-AWQ", "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/JoshuaWong/Nanonets-OCR-s-AWQ
- SGLang
How to use JoshuaWong/Nanonets-OCR-s-AWQ 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 "JoshuaWong/Nanonets-OCR-s-AWQ" \ --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": "JoshuaWong/Nanonets-OCR-s-AWQ", "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 "JoshuaWong/Nanonets-OCR-s-AWQ" \ --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": "JoshuaWong/Nanonets-OCR-s-AWQ", "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" } } ] } ] }' - Unsloth Studio
How to use JoshuaWong/Nanonets-OCR-s-AWQ with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for JoshuaWong/Nanonets-OCR-s-AWQ to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for JoshuaWong/Nanonets-OCR-s-AWQ to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for JoshuaWong/Nanonets-OCR-s-AWQ to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="JoshuaWong/Nanonets-OCR-s-AWQ", max_seq_length=2048, ) - Docker Model Runner
How to use JoshuaWong/Nanonets-OCR-s-AWQ with Docker Model Runner:
docker model run hf.co/JoshuaWong/Nanonets-OCR-s-AWQ
Upload folder using huggingface_hub
Browse files- .msc +0 -0
- .mv +1 -1
- config.json +7 -3
- generation_config.json +1 -2
- model.safetensors +1 -1
- recipe.yaml +6 -0
.msc
CHANGED
|
Binary files a/.msc and b/.msc differ
|
|
|
.mv
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Revision:master,CreatedAt:
|
|
|
|
| 1 |
+
Revision:master,CreatedAt:1755062608
|
config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
"Qwen2_5_VLForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"attention_dropout": 0.0,
|
|
|
|
| 6 |
"eos_token_id": 151645,
|
| 7 |
"hidden_act": "silu",
|
| 8 |
"hidden_size": 2048,
|
|
@@ -15,7 +16,6 @@
|
|
| 15 |
"num_attention_heads": 16,
|
| 16 |
"num_hidden_layers": 36,
|
| 17 |
"num_key_value_heads": 2,
|
| 18 |
-
"pad_token_id": 151654,
|
| 19 |
"quantization_config": {
|
| 20 |
"config_groups": {
|
| 21 |
"group_0": {
|
|
@@ -207,7 +207,12 @@
|
|
| 207 |
],
|
| 208 |
"kv_cache_scheme": null,
|
| 209 |
"quant_method": "compressed-tensors",
|
| 210 |
-
"quantization_status": "compressed"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
},
|
| 212 |
"rms_norm_eps": 1e-06,
|
| 213 |
"rope_scaling": {
|
|
@@ -263,7 +268,6 @@
|
|
| 263 |
},
|
| 264 |
"torch_dtype": "bfloat16",
|
| 265 |
"transformers_version": "4.52.4",
|
| 266 |
-
"unsloth_fixed": true,
|
| 267 |
"use_cache": true,
|
| 268 |
"use_sliding_window": false,
|
| 269 |
"video_token_id": 151656,
|
|
|
|
| 3 |
"Qwen2_5_VLForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": 151643,
|
| 7 |
"eos_token_id": 151645,
|
| 8 |
"hidden_act": "silu",
|
| 9 |
"hidden_size": 2048,
|
|
|
|
| 16 |
"num_attention_heads": 16,
|
| 17 |
"num_hidden_layers": 36,
|
| 18 |
"num_key_value_heads": 2,
|
|
|
|
| 19 |
"quantization_config": {
|
| 20 |
"config_groups": {
|
| 21 |
"group_0": {
|
|
|
|
| 207 |
],
|
| 208 |
"kv_cache_scheme": null,
|
| 209 |
"quant_method": "compressed-tensors",
|
| 210 |
+
"quantization_status": "compressed",
|
| 211 |
+
"bits": 4,
|
| 212 |
+
"group_size": 128,
|
| 213 |
+
"quant_method": "awq",
|
| 214 |
+
"version": "gemm",
|
| 215 |
+
"zero_point": true
|
| 216 |
},
|
| 217 |
"rms_norm_eps": 1e-06,
|
| 218 |
"rope_scaling": {
|
|
|
|
| 268 |
},
|
| 269 |
"torch_dtype": "bfloat16",
|
| 270 |
"transformers_version": "4.52.4",
|
|
|
|
| 271 |
"use_cache": true,
|
| 272 |
"use_sliding_window": false,
|
| 273 |
"video_token_id": 151656,
|
generation_config.json
CHANGED
|
@@ -5,8 +5,7 @@
|
|
| 5 |
151645,
|
| 6 |
151643
|
| 7 |
],
|
| 8 |
-
"
|
| 9 |
-
"pad_token_id": 151654,
|
| 10 |
"repetition_penalty": 1.05,
|
| 11 |
"temperature": 1e-06,
|
| 12 |
"transformers_version": "4.52.4"
|
|
|
|
| 5 |
151645,
|
| 6 |
151643
|
| 7 |
],
|
| 8 |
+
"pad_token_id": 151643,
|
|
|
|
| 9 |
"repetition_penalty": 1.05,
|
| 10 |
"temperature": 1e-06,
|
| 11 |
"transformers_version": "4.52.4"
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4024151208
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1eaa4f6b735db4f9aad9d1bfab7f027476780c1162da9291e1e412d9d57b936f
|
| 3 |
size 4024151208
|
recipe.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
default_stage:
|
| 2 |
+
default_modifiers:
|
| 3 |
+
AWQModifier:
|
| 4 |
+
targets: [Linear]
|
| 5 |
+
ignore: [lm_head, 're:visual.*', 're:model.visual.*']
|
| 6 |
+
scheme: W4A16_ASYM
|