ollama - 💡(How to fix) Fix Support for Baidu Qianfan-OCR 4B model [5 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15057Fetched 2026-04-08 01:31:33
View on GitHub
Comments
5
Participants
3
Timeline
7
Reactions
0
Author
Timeline (top)
commented ×5labeled ×1subscribed ×1
RAW_BUFFERClick to expand / collapse

This is a strong OCR with allegedly high-quality results surpassing DeepSeek OCR V2 and Gemini 3/3.1 Pro on some benchmarks.

https://huggingface.co/baidu/Qianfan-OCR

Offers direct image-to-Markdown conversion, 192 Languages, and "Layout-as-Thought" (more about it in the model description).

This multimodal model uses Qwen3 for the LLM and the InternVL derived Qianfan-ViT as the vision encoder.

extent analysis

Fix Plan

To integrate the Qianfan-OCR model for image-to-Markdown conversion, follow these steps:

  • Install the required libraries: transformers and Pillow
  • Import necessary modules and load the Qianfan-OCR model
  • Preprocess the input image and pass it to the model for conversion

Example Code

from PIL import Image
from transformers import AutoFeatureExtractor, AutoModelForVision2Seq

# Load the Qianfan-OCR model and feature extractor
model_name = "baidu/Qianfan-OCR"
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
model = AutoModelForVision2Seq.from_pretrained(model_name)

# Load the input image
image = Image.open("input_image.png")

# Preprocess the image
inputs = feature_extractor(images=image, return_tensors="pt")

# Convert the image to Markdown
output = model.generate(**inputs)

# Print the generated Markdown
print(output)

Verification

To verify the fix, check the output Markdown for correctness and compare it with the expected result.

Extra Tips

  • Make sure to install the required libraries and import the necessary modules.
  • Adjust the model and feature extractor names according to your specific use case.
  • Refer to the Hugging Face documentation for more information on using the Qianfan-OCR model.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING