unsloth/LaTeX_OCR
Viewer • Updated • 76.3k • 6.73k • 72
How to use Weidows/Qwen3.5-4B-LaTeX with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="Weidows/Qwen3.5-4B-LaTeX")
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, AutoModelForImageTextToText
processor = AutoProcessor.from_pretrained("Weidows/Qwen3.5-4B-LaTeX")
model = AutoModelForImageTextToText.from_pretrained("Weidows/Qwen3.5-4B-LaTeX")
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]:]))How to use Weidows/Qwen3.5-4B-LaTeX with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Weidows/Qwen3.5-4B-LaTeX", filename="Qwen3.5-4B.F16-mmproj.gguf", )
llm.create_chat_completion(
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 Weidows/Qwen3.5-4B-LaTeX with llama.cpp:
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
docker model run hf.co/Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
How to use Weidows/Qwen3.5-4B-LaTeX with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Weidows/Qwen3.5-4B-LaTeX"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Weidows/Qwen3.5-4B-LaTeX",
"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/Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
How to use Weidows/Qwen3.5-4B-LaTeX with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Weidows/Qwen3.5-4B-LaTeX" \
--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": "Weidows/Qwen3.5-4B-LaTeX",
"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 "Weidows/Qwen3.5-4B-LaTeX" \
--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": "Weidows/Qwen3.5-4B-LaTeX",
"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 Weidows/Qwen3.5-4B-LaTeX with Ollama:
ollama run hf.co/Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
How to use Weidows/Qwen3.5-4B-LaTeX with Unsloth Studio:
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 Weidows/Qwen3.5-4B-LaTeX to start chatting
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 Weidows/Qwen3.5-4B-LaTeX to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Weidows/Qwen3.5-4B-LaTeX to start chatting
How to use Weidows/Qwen3.5-4B-LaTeX with Pi:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
# Install Pi:
npm install -g @mariozechner/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"llama-cpp": {
"baseUrl": "http://localhost:8080/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "Weidows/Qwen3.5-4B-LaTeX:Q4_K_M"
}
]
}
}
}# Start Pi in your project directory: pi
How to use Weidows/Qwen3.5-4B-LaTeX with Hermes Agent:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
hermes
How to use Weidows/Qwen3.5-4B-LaTeX with Docker Model Runner:
docker model run hf.co/Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
How to use Weidows/Qwen3.5-4B-LaTeX with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Weidows/Qwen3.5-4B-LaTeX:Q4_K_M
lemonade run user.Qwen3.5-4B-LaTeX-Q4_K_M
lemonade list
This model was finetuned and converted to GGUF format using Unsloth.
Example usage:
llama-cli -hf Weidows/Qwen3.5-4B-LaTeX --jinjallama-mtmd-cli -hf Weidows/Qwen3.5-4B-LaTeX --jinjaQwen3.5-4B.Q5_K_M.ggufQwen3.5-4B.Q8_0.ggufQwen3.5-4B.Q4_K_M.ggufQwen3.5-4B.F16-mmproj.gguf
This was trained 2x faster with Unsloth
