NuExtract3
Collection
Quantized NuExtract3 models for efficient image-text understanding (AutoRound W4A16) • 3 items • Updated
How to use Vishva007/NuExtract3-W4A16-AutoRound-GPTQ with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Vishva007/NuExtract3-W4A16-AutoRound-GPTQ"
# 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/NuExtract3-W4A16-AutoRound-GPTQ",
"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 run hf.co/Vishva007/NuExtract3-W4A16-AutoRound-GPTQ
How to use Vishva007/NuExtract3-W4A16-AutoRound-GPTQ with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Vishva007/NuExtract3-W4A16-AutoRound-GPTQ" \
--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/NuExtract3-W4A16-AutoRound-GPTQ",
"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 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/NuExtract3-W4A16-AutoRound-GPTQ" \
--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/NuExtract3-W4A16-AutoRound-GPTQ",
"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"
}
}
]
}
]
}'How to use Vishva007/NuExtract3-W4A16-AutoRound-GPTQ with Docker Model Runner:
docker model run hf.co/Vishva007/NuExtract3-W4A16-AutoRound-GPTQ
W4A16 (4-bit integer weights, 16-bit activations) quantized builds of numind/NuExtract3 created using Intel's AutoRound algorithm.
True)quant_nontext_module): Kept in BF16 to preserve visual document parsing and OCR accuracymtp, mtp.fc) kept in native bfloat16Vishva007/NuExtract3-W4A16-AutoRoundVishva007/NuExtract3-W4A16-AutoRound-GPTQVishva007/NuExtract3-W4A16-AutoRound-LLM-Compressorvllm serve Vishva007/NuExtract3-W4A16-AutoRound-GPTQ \
--trust-remote-code \
--limit-mm-per-prompt '{"image": 10, "video": 0}' \
--chat-template-content-format openai \
--generation-config vllm \
--max-model-len 16384 \
--dtype bfloat16 \
--gpu-memory-utilization 0.90
import base64
import json
from openai import OpenAI
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
def encode_image(image_path):
with open(image_path, "rb") as f:
return base64.b64encode(f.read()).decode("utf-8")
data_url = f"data:image/png;base64,{encode_image('document.png')}"
# Structured JSON Extraction
template = {
"invoice_number": "verbatim-string",
"date": "date-time",
"total": "number",
"line_items": [{"description": "verbatim-string", "amount": "number"}]
}
response = client.chat.completions.create(
model="Vishva007/NuExtract3-W4A16-AutoRound-GPTQ",
temperature=0.2,
messages=[
{"role": "user", "content": [{"type": "image_url", "image_url": {"url": data_url}}]}
],
extra_body={
"chat_template_kwargs": {
"enable_thinking": False
}
}
)
print(response.choices[0].message.content)
For Markdown OCR: Replace
templateinchat_template_kwargswith"mode": "markdown".