[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-allenai--olmocr":3,"tool-allenai--olmocr":64},[4,17,26,40,48,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,2,"2026-04-03T11:11:01",[13,14,15],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":23,"last_commit_at":32,"category_tags":33,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,34,35,36,15,37,38,13,39],"数据工具","视频","插件","其他","语言模型","音频",{"id":41,"name":42,"github_repo":43,"description_zh":44,"stars":45,"difficulty_score":10,"last_commit_at":46,"category_tags":47,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,38,37],{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":10,"last_commit_at":54,"category_tags":55,"status":16},519,"PaddleOCR","PaddlePaddle\u002FPaddleOCR","PaddleOCR 是一款基于百度飞桨框架开发的高性能开源光学字符识别工具包。它的核心能力是将图片、PDF 等文档中的文字提取出来，转换成计算机可读取的结构化数据，让机器真正“看懂”图文内容。\n\n面对海量纸质或电子文档，PaddleOCR 解决了人工录入效率低、数字化成本高的问题。尤其在人工智能领域，它扮演着连接图像与大型语言模型（LLM）的桥梁角色，能将视觉信息直接转化为文本输入，助力智能问答、文档分析等应用场景落地。\n\nPaddleOCR 适合开发者、算法研究人员以及有文档自动化需求的普通用户。其技术优势十分明显：不仅支持全球 100 多种语言的识别，还能在 Windows、Linux、macOS 等多个系统上运行，并灵活适配 CPU、GPU、NPU 等各类硬件。作为一个轻量级且社区活跃的开源项目，PaddleOCR 既能满足快速集成的需求，也能支撑前沿的视觉语言研究，是处理文字识别任务的理想选择。",74913,"2026-04-05T10:44:17",[38,14,13,37],{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":23,"last_commit_at":62,"category_tags":63,"status":16},2471,"tesseract","tesseract-ocr\u002Ftesseract","Tesseract 是一款历史悠久且备受推崇的开源光学字符识别（OCR）引擎，最初由惠普实验室开发，后由 Google 维护，目前由全球社区共同贡献。它的核心功能是将图片中的文字转化为可编辑、可搜索的文本数据，有效解决了从扫描件、照片或 PDF 文档中提取文字信息的难题，是数字化归档和信息自动化的重要基础工具。\n\n在技术层面，Tesseract 展现了强大的适应能力。从版本 4 开始，它引入了基于长短期记忆网络（LSTM）的神经网络 OCR 引擎，显著提升了行识别的准确率；同时，为了兼顾旧有需求，它依然支持传统的字符模式识别引擎。Tesseract 原生支持 UTF-8 编码，开箱即用即可识别超过 100 种语言，并兼容 PNG、JPEG、TIFF 等多种常见图像格式。输出方面，它灵活支持纯文本、hOCR、PDF、TSV 等多种格式，方便后续数据处理。\n\nTesseract 主要面向开发者、研究人员以及需要构建文档处理流程的企业用户。由于它本身是一个命令行工具和库（libtesseract），不包含图形用户界面（GUI），因此最适合具备一定编程能力的技术人员集成到自动化脚本或应用程序中",73286,"2026-04-03T01:56:45",[13,14],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":80,"owner_twitter":79,"owner_website":81,"owner_url":82,"languages":83,"stars":104,"forks":105,"last_commit_at":106,"license":107,"difficulty_score":10,"env_os":108,"env_gpu":109,"env_ram":110,"env_deps":111,"category_tags":119,"github_topics":79,"view_count":120,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":121,"updated_at":122,"faqs":123,"releases":152},2074,"allenai\u002Folmocr","olmocr","Toolkit for linearizing PDFs for LLM datasets\u002Ftraining","olmocr 是一款专为大语言模型训练打造的开源工具，旨在将复杂的 PDF 及图片文档高效转化为干净、可读的纯文本或 Markdown 格式。它主要解决了传统 OCR 技术在处理学术论文、扫描古籍等文档时面临的痛点：难以识别数学公式与表格、无法自动剔除页眉页脚干扰，以及在多栏排版或图文混排场景中阅读顺序混乱等问题。\n\n无论是需要构建高质量数据集的 AI 研究人员和开发者，还是希望从老旧扫描件中快速提取内容的专业人士，olmocr 都能提供极大便利。其核心技术亮点在于基于 70 亿参数的视觉语言模型（VLM），不仅能精准还原手写体、复杂公式和表格结构，还能智能理解版面布局，确保输出文本符合自然阅读逻辑。此外，olmocr 在成本控制上表现优异，每百万页转换成本低于 200 美元，并提供了完善的基准测试套件（olmOCR-Bench）以量化评估效果。通过持续的版本迭代，它在处理自动旋转检测和减少幻觉生成方面也不断优化，是让非结构化文档变为优质训练数据的高效助手。","\u003Cdiv align=\"center\">\n  \u003Cimg width=\"350\" alt=\"olmocr-2-full@2x\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_olmocr_readme_719b7d21a3d0.png\" \u002F>\n\u003Chr\u002F>\n\u003C\u002Fdiv>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fallenai\u002FOLMo\u002Fblob\u002Fmain\u002FLICENSE\">\n    \u003Cimg alt=\"GitHub License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fallenai\u002FOLMo\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Freleases\">\n    \u003Cimg alt=\"GitHub release\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fallenai\u002Folmocr.svg\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.18443\">\n    \u003Cimg alt=\"Tech Report v1\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper_v1-olmOCR-blue\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.19817\">\n    \u003Cimg alt=\"Tech Report v2\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper_v2-olmOCR-blue\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Folmocr.allenai.org\">\n    \u003Cimg alt=\"Demo\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAi2-Demo-F0529C\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FsZq3jTNVNG\">\n    \u003Cimg alt=\"Discord\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord%20-%20blue?style=flat&logo=discord&label=Ai2&color=%235B65E9\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\nA toolkit for converting PDFs and other image-based document formats into clean, readable, plain text format.\n\nTry the online demo: [https:\u002F\u002Folmocr.allenai.org\u002F](https:\u002F\u002Folmocr.allenai.org\u002F)\n\nFeatures:\n - Convert PDF, PNG, and JPEG based documents into clean Markdown\n - Support for equations, tables, handwriting, and complex formatting\n - Automatically removes headers and footers\n - Convert into text with a natural reading order, even in the presence of\n   figures, multi-column layouts, and insets\n - Efficient, less than $200 USD per million pages converted\n - (Based on a 7B parameter VLM, so it requires a GPU)\n\n### News\n - October 21, 2025 - v0.4.0 - [New model release](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-2-7B-1025-FP8), boosts olmOCR-bench score by ~4 points using synthetic data and introduces RL training.\n - August 13, 2025 - v0.3.0 - [New model release](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-7B-0825-FP8), fixes auto-rotation detection, and hallucinations on blank documents.\n - July 24, 2025 - v0.2.1 - [New model release](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-7B-0725-FP8), scores 3 points higher on [olmOCR-Bench](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench), also runs significantly faster because it's default FP8, and needs much fewer retries per document.\n - July 23, 2025 - v0.2.0 - New cleaned up [trainer code](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Ftrain), makes it much simpler to train olmOCR models yourself.\n - June 17, 2025 - v0.1.75 - Switch from sglang to vllm based inference pipeline, updated docker image to CUDA 12.8.\n - May 23, 2025 - v0.1.70 - Official docker support and images are now available! [See Docker usage](#using-docker)\n - May 19, 2025 - v0.1.68 - [olmOCR-Bench](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench) launch, scoring 77.4. Launch includes 2 point performance boost in olmOCR pipeline due to bug fixes with prompts.\n - Mar 17, 2025 - v0.1.60 - Performance improvements due to better temperature selection in sampling.\n - Feb 25, 2025 - v0.1.58 -  Initial public launch and demo.\n\n### Benchmark\n\n[**olmOCR-Bench**](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench):\nWe also ship a comprehensive benchmark suite covering over 7,000 test cases across 1,400 documents to help measure performance of OCR systems. \n\n\u003Ctable>\n    \u003Cthead>\n        \u003Ctr>\n            \u003Cth>\u003C\u002Fth>\n            \u003Cth>ArXiv\u003C\u002Fth>\n            \u003Cth>Old\u003Cbr>scans\u003Cbr>math\u003C\u002Fth>\n            \u003Cth>Tables\u003C\u002Fth>\n            \u003Cth>Old\u003Cbr>scans\u003C\u002Fth>\n            \u003Cth>Headers\u003Cbr>&\u003Cbr>footers\u003C\u002Fth>\n            \u003Cth>Multi\u003Cbr>column\u003C\u002Fth>\n            \u003Cth>Long\u003Cbr>tiny\u003Cbr>text\u003C\u002Fth>\n            \u003Cth>Base\u003C\u002Fth>\n            \u003Cth>Overall\u003C\u002Fth>\n        \u003C\u002Ftr>\n    \u003C\u002Fthead>\n    \u003Ctbody>\n        \u003Ctr>\n            \u003Ctd>Mistral OCR API\u003C\u002Ftd>\n            \u003Ctd>77.2\u003C\u002Ftd>\n            \u003Ctd>67.5\u003C\u002Ftd>\n            \u003Ctd>60.6\u003C\u002Ftd>\n            \u003Ctd>29.3\u003C\u002Ftd>\n            \u003Ctd>93.6\u003C\u002Ftd>\n            \u003Ctd>71.3\u003C\u002Ftd>\n            \u003Ctd>77.1\u003C\u002Ftd>\n            \u003Ctd>99.4\u003C\u002Ftd>\n            \u003Ctd>72.0±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Marker 1.10.1\u003C\u002Ftd>\n            \u003Ctd>83.8\u003C\u002Ftd>\n            \u003Ctd>66.8\u003C\u002Ftd>\n            \u003Ctd>72.9\u003C\u002Ftd>\n            \u003Ctd>33.5\u003C\u002Ftd>\n            \u003Ctd>86.6\u003C\u002Ftd>\n            \u003Ctd>80.0\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>99.3\u003C\u002Ftd>\n            \u003Ctd>76.1±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>MinerU 2.5.4*\u003C\u002Ftd>\n            \u003Ctd>76.6\u003C\u002Ftd>\n            \u003Ctd>54.6\u003C\u002Ftd>\n            \u003Ctd>84.9\u003C\u002Ftd>\n            \u003Ctd>33.7\u003C\u002Ftd>\n            \u003Ctd>96.6\u003C\u002Ftd>\n            \u003Ctd>78.2\u003C\u002Ftd>\n            \u003Ctd>83.5\u003C\u002Ftd>\n            \u003Ctd>93.7\u003C\u002Ftd>\n            \u003Ctd>75.2±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>DeepSeek-OCR\u003C\u002Ftd>\n            \u003Ctd>77.2\u003C\u002Ftd>\n            \u003Ctd>73.6\u003C\u002Ftd>\n            \u003Ctd>80.2\u003C\u002Ftd>\n            \u003Ctd>33.3\u003C\u002Ftd>\n            \u003Ctd>96.1\u003C\u002Ftd>\n            \u003Ctd>66.4\u003C\u002Ftd>\n            \u003Ctd>79.4\u003C\u002Ftd>\n            \u003Ctd>99.8\u003C\u002Ftd>\n            \u003Ctd>75.7±1.0\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Nanonets-OCR2-3B\u003C\u002Ftd>\n            \u003Ctd>75.4\u003C\u002Ftd>\n            \u003Ctd>46.1\u003C\u002Ftd>\n            \u003Ctd>86.8\u003C\u002Ftd>\n            \u003Ctd>40.9\u003C\u002Ftd>\n            \u003Ctd>32.1\u003C\u002Ftd>\n            \u003Ctd>81.9\u003C\u002Ftd>\n            \u003Ctd>93.0\u003C\u002Ftd>\n            \u003Ctd>99.6\u003C\u002Ftd>\n            \u003Ctd>69.5±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>PaddleOCR-VL*\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>71.0\u003C\u002Ftd>\n            \u003Ctd>84.1\u003C\u002Ftd>\n            \u003Ctd>37.8\u003C\u002Ftd>\n            \u003Ctd>97.0\u003C\u002Ftd>\n            \u003Ctd>79.9\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>98.5\u003C\u002Ftd>\n            \u003Ctd>80.0±1.0\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Infinity-Parser 7B*\u003C\u002Ftd>\n            \u003Ctd>84.4\u003C\u002Ftd>\n            \u003Ctd>83.8\u003C\u002Ftd>\n            \u003Ctd>85.0\u003C\u002Ftd>\n            \u003Ctd>47.9\u003C\u002Ftd>\n            \u003Ctd>88.7\u003C\u002Ftd>\n            \u003Ctd>84.2\u003C\u002Ftd>\n            \u003Ctd>86.4\u003C\u002Ftd>\n            \u003Ctd>99.8\u003C\u002Ftd>\n            \u003Ctd>82.5±?\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Chandra OCR 0.1.0*\u003C\u002Ftd>\n            \u003Ctd>82.2\u003C\u002Ftd>\n            \u003Ctd>80.3\u003C\u002Ftd>\n            \u003Ctd>88.0\u003C\u002Ftd>\n            \u003Ctd>50.4\u003C\u002Ftd>\n            \u003Ctd>90.8\u003C\u002Ftd>\n            \u003Ctd>81.2\u003C\u002Ftd>\n            \u003Ctd>92.3\u003C\u002Ftd>\n            \u003Ctd>99.9\u003C\u002Ftd>\n            \u003Ctd>83.1±0.9\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd colspan=\"10\">\u003Chr>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>olmOCR v0.4.0\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>83.0\u003C\u002Ftd>\n            \u003Ctd>82.3\u003C\u002Ftd>\n            \u003Ctd>84.9\u003C\u002Ftd>\n            \u003Ctd>47.7\u003C\u002Ftd>\n            \u003Ctd>96.1\u003C\u002Ftd>\n            \u003Ctd>83.7\u003C\u002Ftd>\n            \u003Ctd>81.9\u003C\u002Ftd>\n            \u003Ctd>99.7\u003C\u002Ftd>\n            \u003Ctd>82.4±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n    \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\n### Installation\n\n#### System Dependencies\n\nYou will need to install poppler-utils and additional fonts for rendering PDF images.\n\nInstall dependencies (Ubuntu\u002FDebian):\n```bash\nsudo apt-get update\nsudo apt-get install poppler-utils ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools\n```\n\n#### Python Installation\n\nSet up a conda environment and install olmocr. The requirements for running olmOCR\nare difficult to install in an existing python environment, so please do make a clean python environment to install into.\n\n```bash\nconda create -n olmocr python=3.11\nconda activate olmocr\n```\n\nChoose the installation option that matches your use case:\n\n**Option 1: Remote Inference (Lightweight)**\n\nIf you plan to use a remote vLLM server with the `--server` flag, install the base package:\n```bash\npip install olmocr\n```\nThis avoids installing heavy GPU dependencies like PyTorch (~2GB+).\n\n**Option 2: Local GPU Inference**\n\nRequirements:\n - Recent NVIDIA GPU (tested on RTX 4090, L40S, A100, H100) with at least 12 GB of GPU RAM\n - 30GB of free disk space\n\nFor running inference with your own GPU:\n```bash\npip install olmocr[gpu] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n\n# Recommended: Install flash infer for faster inference on GPU\npip install https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\u002Fflashinfer\u002Fflashinfer_python-0.2.5%2Bcu128torch2.7-cp38-abi3-linux_x86_64.whl\n```\n\n**Option 3: Beaker Cluster Execution**\n\nFor submitting jobs to Beaker clusters with the `--beaker` flag:\n```bash\npip install olmocr[beaker]\n```\n\n**Option 4: Benchmark Suite**\n\nFor running the olmOCR benchmark suite:\n```bash\npip install olmocr[bench]\n```\n\n**Combined Installation**\n\nYou can combine multiple options:\n```bash\n# GPU + Beaker support\npip install olmocr[gpu,beaker] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n\n# GPU + Benchmark support\npip install olmocr[gpu,bench] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n**Troubleshooting**\n\nIf you run into errors about `too many open files`, update your ulimit:\n```bash\nulimit -n 65536\n```\n\n### Usage Examples\n\nFor quick testing, try the [web demo](https:\u002F\u002Folmocr.allen.ai\u002F).\n\n**Convert a Single PDF (Local GPU):**\n```bash\n# Download a sample PDF\ncurl -o olmocr-sample.pdf https:\u002F\u002Folmocr.allenai.org\u002Fpapers\u002Folmocr_3pg_sample.pdf\n\n# Convert it to markdown\nolmocr .\u002Flocalworkspace --markdown --pdfs olmocr-sample.pdf\n```\n\n**Convert an Image file:**\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs random_page.png\n```\n\n**Convert Multiple PDFs:**\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf\n```\n\n**Use Remote Inference Server:**\n```bash\nolmocr .\u002Flocalworkspace --server http:\u002F\u002Fremote-server:8000\u002Fv1 --model allenai\u002FolmOCR-2-7B-1025-FP8 --markdown --pdfs *.pdf\n```\n\nWith the `--markdown` flag, results will be stored as markdown files inside of `.\u002Flocalworkspace\u002Fmarkdown\u002F`.\n\n> **Note:** You can also use `python -m olmocr.pipeline` instead of `olmocr` if you prefer. \n\n#### Viewing Results\n\nThe `.\u002Flocalworkspace\u002F` workspace folder will then have both [Dolma](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) and markdown files (if using `--markdown`).\n\n\n```bash\ncat localworkspace\u002Fmarkdown\u002Folmocr-sample.md \n```\n\n```\nolmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models\n...\n```\n\n### Using an Inference Provider or External Server\n\nIf you have a vLLM server already running elsewhere (or any inference platform implementing the OpenAI API), you can point olmOCR to use it instead of spawning a local instance.\n\n**Installation for Remote Inference:**\n```bash\n# Lightweight installation - no GPU dependencies needed\npip install olmocr\n```\n\n**Using an External Server:**\n```bash\n# Use external vLLM server instead of local one\nolmocr .\u002Flocalworkspace --server http:\u002F\u002Fremote-server:8000\u002Fv1 --model allenai\u002FolmOCR-2-7B-1025-FP8 --markdown --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf\n```\n\nThe served model name in vLLM needs to match the value provided in `--model`.\n\n**Example vLLM Server Launch:**\n```bash\nvllm serve allenai\u002FolmOCR-2-7B-1025-FP8 --max-model-len 16384\n```\n\n#### Verified External Providers\n\nWe have tested `olmOCR-2-7B-1025-FP8` on these external model providers and confirmed that they work\n\n|                                                                             | $\u002F1M Input tokens | $\u002F1M Output tokens | Example Command                                                                                                                                                                |\n|-----------------------------------------------------------------------------|-------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Cirrascale](https:\u002F\u002Fai2endpoints.cirrascale.ai\u002Fmodels\u002Foverview)            | $0.07             | $0.15              | `olmocr .\u002Fworkspace --server https:\u002F\u002Fai2endpoints.cirrascale.ai\u002Fapi --api_key sk-XXXXXXX --workers 1 --max_concurrent_requests 20 --model olmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf`     |\n| [DeepInfra](https:\u002F\u002Fdeepinfra.com\u002F)                                         | $0.09             | $0.19              | `olmocr .\u002Fworkspace --server https:\u002F\u002Fapi.deepinfra.com\u002Fv1\u002Fopenai --api_key DfXXXXXXX --workers 1 --max_concurrent_requests 20 --model allenai\u002FolmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf` |\n| [Parasail](https:\u002F\u002Fwww.saas.parasail.io\u002Fserverless?name=olmocr-7b-1025-fp8) | $0.10             | $0.20              | `olmocr .\u002Fworkspace --server https:\u002F\u002Fapi.parasail.io\u002Fv1 --api_key psk-XXXXX --workers 1 --max_concurrent_requests 20 --model allenai\u002FolmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf`          |\n\n\nNotes on arguments\n- `--server`: Defines the OpenAI-compatible endpoint: ex `https:\u002F\u002Fapi.deepinfra.com\u002Fv1\u002Fopenai`\n- `--api_key`: Your API key, bassed in via Authorization Bearer HTTP header\n- `--max_concurrent_requests`: Max concurrent requests that will be in-flight to the inference provider at one time\n- `--workers`: Max number of page groups that will be processed at once. You may want to set this to `1` so that you finish one group of stuff before moving on.\n- `--pages_per_group`: You may want a smaller number of pages per group as many external provides have lower concurrent request limits\n- `--model`: The model identifier, ex. `allenai\u002FolmOCR-2-7B-1025`, different providers have different names, and if you run locally, you can use `olmocr`\n- Other arguments work the same as with local inference\n\n\n### Multi-node \u002F Cluster Usage\n\nIf you want to convert millions of PDFs using multiple nodes running in parallel, olmOCR supports\nreading PDFs from AWS S3 and coordinating work using an AWS S3 output bucket.\n\n**Start the first worker node:**\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace --pdfs s3:\u002F\u002Fmy_s3_bucket\u002Fjakep\u002Fgnarly_pdfs\u002F*.pdf\n```\n\nThis sets up a simple work queue in your AWS bucket and starts converting PDFs.\n\n**On subsequent worker nodes:**\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace\n```\n\nThey will automatically start grabbing items from the same workspace queue.\n\n#### Using Beaker for Cluster Execution\n\nIf you are at Ai2 and want to linearize millions of PDFs efficiently using [beaker](https:\u002F\u002Fwww.beaker.org), install with Beaker support:\n\n```bash\npip install olmocr[gpu,beaker] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\nThen use the `--beaker` flag to prepare the workspace locally and launch N GPU workers in the cluster:\n\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace --pdfs s3:\u002F\u002Fmy_s3_bucket\u002Fjakep\u002Fgnarly_pdfs\u002F*.pdf --beaker --beaker_gpus 4\n```\n\n\n### Using Docker\n\nPull the Docker image (large, includes the model, ~30GB):\n```bash\ndocker pull alleninstituteforai\u002Folmocr:latest-with-model\n```\n\nFor advanced users who want to manage their own model downloads, we also provide a base image without the model:\n```bash\ndocker pull alleninstituteforai\u002Folmocr:latest\n```\n\n#### Quick Start - Process PDFs\n\nProcess a single PDF in your current directory:\n```bash\ndocker run --gpus all \\\n  -v $(pwd):\u002Fworkspace \\\n  alleninstituteforai\u002Folmocr:latest-with-model \\\n  -c \"olmocr \u002Fworkspace\u002Foutput --markdown --pdfs \u002Fworkspace\u002Fsample.pdf\"\n```\n\nProcess multiple PDFs:\n```bash\ndocker run --gpus all \\\n  -v \u002Fpath\u002Fto\u002Fpdfs:\u002Finput \\\n  -v \u002Fpath\u002Fto\u002Foutput:\u002Foutput \\\n  alleninstituteforai\u002Folmocr:latest-with-model \\\n  -c \"olmocr \u002Foutput --markdown --pdfs \u002Finput\u002F*.pdf\"\n```\n\n#### Interactive Mode\n\nRun the container interactively for exploration and debugging:\n```bash\ndocker run -it --gpus all alleninstituteforai\u002Folmocr:latest-with-model\n```\n\n> Visit our Docker repository on [Docker Hub](https:\u002F\u002Fhub.docker.com\u002Fr\u002Falleninstituteforai\u002Folmocr) for more information.\n\n### Full Documentation\n\nTo see all available options:\n```bash\nolmocr --help\nusage: pipeline.py [-h] [--pdfs [PDFS ...]] [--model MODEL] [--workspace_profile WORKSPACE_PROFILE] [--pdf_profile PDF_PROFILE] [--pages_per_group PAGES_PER_GROUP] [--max_page_retries MAX_PAGE_RETRIES] [--max_page_error_rate MAX_PAGE_ERROR_RATE] [--workers WORKERS]\n                   [--apply_filter] [--stats] [--markdown] [--target_longest_image_dim TARGET_LONGEST_IMAGE_DIM] [--target_anchor_text_len TARGET_ANCHOR_TEXT_LEN] [--guided_decoding] [--gpu-memory-utilization GPU_MEMORY_UTILIZATION] [--max_model_len MAX_MODEL_LEN]\n                   [--tensor-parallel-size TENSOR_PARALLEL_SIZE] [--data-parallel-size DATA_PARALLEL_SIZE] [--port PORT] [--server SERVER] [--beaker] [--beaker_workspace BEAKER_WORKSPACE] [--beaker_cluster BEAKER_CLUSTER] [--beaker_gpus BEAKER_GPUS] [--beaker_priority BEAKER_PRIORITY]\n                   workspace\n\nManager for running millions of PDFs through a batch inference pipeline\n\npositional arguments:\n  workspace             The filesystem path where work will be stored, can be a local folder, or an s3 path if coordinating work with many workers, s3:\u002F\u002Fbucket\u002Fprefix\u002F\n\noptions:\n  -h, --help            show this help message and exit\n  --pdfs [PDFS ...]     Path to add pdfs stored in s3 to the workspace, can be a glob path s3:\u002F\u002Fbucket\u002Fprefix\u002F*.pdf or path to file containing list of pdf paths\n  --model MODEL         Path where the model is located, allenai\u002FolmOCR-7B-0725-FP8 is the default, can be local, s3, or hugging face.\n  --workspace_profile WORKSPACE_PROFILE\n                        S3 configuration profile for accessing the workspace\n  --pdf_profile PDF_PROFILE\n                        S3 configuration profile for accessing the raw pdf documents\n  --pages_per_group PAGES_PER_GROUP\n                        Aiming for this many pdf pages per work item group\n  --max_page_retries MAX_PAGE_RETRIES\n                        Max number of times we will retry rendering a page\n  --max_page_error_rate MAX_PAGE_ERROR_RATE\n                        Rate of allowable failed pages in a document, 1\u002F250 by default\n  --workers WORKERS     Number of workers to run at a time\n  --apply_filter        Apply basic filtering to English pdfs which are not forms, and not likely seo spam\n  --stats               Instead of running any job, reports some statistics about the current workspace\n  --markdown            Also write natural text to markdown files preserving the folder structure of the input pdfs\n  --target_longest_image_dim TARGET_LONGEST_IMAGE_DIM\n                        Dimension on longest side to use for rendering the pdf pages\n  --target_anchor_text_len TARGET_ANCHOR_TEXT_LEN\n                        Maximum amount of anchor text to use (characters), not used for new models\n  --guided_decoding     Enable guided decoding for model YAML type outputs\n\nVLLM arguments:\n  --gpu-memory-utilization GPU_MEMORY_UTILIZATION\n                        Fraction of VRAM vLLM may pre-allocate for KV-cache (passed through to vllm serve).\n  --max_model_len MAX_MODEL_LEN\n                        Upper bound (tokens) vLLM will allocate KV-cache for, lower if VLLM won't start\n  --tensor-parallel-size TENSOR_PARALLEL_SIZE, -tp TENSOR_PARALLEL_SIZE\n                        Tensor parallel size for vLLM\n  --data-parallel-size DATA_PARALLEL_SIZE, -dp DATA_PARALLEL_SIZE\n                        Data parallel size for vLLM\n  --port PORT           Port to use for the VLLM server\n  --server SERVER       URL of external vLLM (or other compatible provider)\n                        server (e.g., http:\u002F\u002Fhostname:port). If provided,\n                        skips spawning local vLLM instance\n\nbeaker\u002Fcluster execution:\n  --beaker              Submit this job to beaker instead of running locally\n  --beaker_workspace BEAKER_WORKSPACE\n                        Beaker workspace to submit to\n  --beaker_cluster BEAKER_CLUSTER\n                        Beaker clusters you want to run on\n  --beaker_gpus BEAKER_GPUS\n                        Number of gpu replicas to run\n  --beaker_priority BEAKER_PRIORITY\n                        Beaker priority level for the job\n```\n\n## Code overview\n\nThere are some nice reusable pieces of the code that may be useful for your own projects:\n - A prompting strategy to get really good natural text parsing using ChatGPT 4o - [buildsilver.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fdata\u002Fbuildsilver.py)\n - Basic filtering by language and SEO spam removal - [filter.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ffilter\u002Ffilter.py)\n - SFT Finetuning code for Qwen2.5-VL - [train.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ftrain\u002Ftrain.py)\n - GRPO RL Trainer - [grpo_train.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ftrain\u002Fgrpo_train.py)\n - Synthetic data generation - [mine_html_templates.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fsynth\u002Fmine_html_templates.py)\n - Processing millions of PDFs through a finetuned model using VLLM - [pipeline.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fpipeline.py)\n - Viewing [Dolma docs](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) created from PDFs - [dolmaviewer.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fviewer\u002Fdolmaviewer.py)\n\n\n\n## Team\n\n\u003C!-- start team -->\n\n**olmOCR** is developed and maintained by the AllenNLP team, backed by [the Allen Institute for Artificial Intelligence (AI2)](https:\u002F\u002Fallenai.org\u002F).\nAI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering.\nTo learn more about who specifically contributed to this codebase, see [our contributors](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fgraphs\u002Fcontributors) page.\n\n\u003C!-- end team -->\n\n## License\n\n\u003C!-- start license -->\n\n**olmOCR** is licensed under [Apache 2.0](https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0).\nA full copy of the license can be found [on GitHub](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002FLICENSE).\n\n\u003C!-- end license -->\n\n## Citing\n\nFor olmOCR v1 and OlmOCR-bench:\n```bibtex\n@misc{olmocrbench,\n      title={{olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models}},\n      author={Jake Poznanski and Jon Borchardt and Jason Dunkelberger and Regan Huff and Daniel Lin and Aman Rangapur and Christopher Wilhelm and Kyle Lo and Luca Soldaini},\n      year={2025},\n      eprint={2502.18443},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.18443},\n}\n```\n\nFor olmOCR v2 Unit Testing Rewards with RL:\n```bibtex\n@misc{olmocr2,\n      title={olmOCR 2: Unit Test Rewards for Document OCR}, \n      author={Jake Poznanski and Luca Soldaini and Kyle Lo},\n      year={2025},\n      eprint={2510.19817},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.19817}, \n}\n```\n","\u003Cdiv align=\"center\">\n  \u003Cimg width=\"350\" alt=\"olmocr-2-full@2x\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_olmocr_readme_719b7d21a3d0.png\" \u002F>\n\u003Chr\u002F>\n\u003C\u002Fdiv>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fallenai\u002FOLMo\u002Fblob\u002Fmain\u002FLICENSE\">\n    \u003Cimg alt=\"GitHub License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fallenai\u002FOLMo\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Freleases\">\n    \u003Cimg alt=\"GitHub release\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fallenai\u002Folmocr.svg\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.18443\">\n    \u003Cimg alt=\"技术报告 v1\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper_v1-olmOCR-blue\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.19817\">\n    \u003Cimg alt=\"技术报告 v2\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper_v2-olmOCR-blue\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Folmocr.allenai.org\">\n    \u003Cimg alt=\"演示\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAi2-Demo-F0529C\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FsZq3jTNVNG\">\n    \u003Cimg alt=\"Discord\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord%20-%20blue?style=flat&logo=discord&label=Ai2&color=%235B65E9\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n一个用于将 PDF 及其他基于图像的文档格式转换为干净、易读的纯文本格式的工具包。\n\n试用在线演示：[https:\u002F\u002Folmocr.allenai.org\u002F](https:\u002F\u002Folmocr.allenai.org\u002F)\n\n特性：\n - 将基于 PDF、PNG 和 JPEG 的文档转换为整洁的 Markdown 格式\n - 支持公式、表格、手写内容以及复杂排版\n - 自动去除页眉和页脚\n - 即使在存在图表、多栏布局和插图的情况下，也能按照自然的阅读顺序转换为文本\n - 高效，每百万页转换成本不到 200 美元\n - （基于 70 亿参数的视觉语言模型，因此需要 GPU）\n\n### 新闻\n - 2025年10月21日 - v0.4.0 - [新模型发布](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-2-7B-1025-FP8)，利用合成数据将 olmOCR 基准测试分数提升了约 4 分，并引入了强化学习训练。\n - 2025年8月13日 - v0.3.0 - [新模型发布](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-7B-0825-FP8)，修复了自动旋转检测问题以及对空白文档的幻觉现象。\n - 2025年7月24日 - v0.2.1 - [新模型发布](https:\u002F\u002Fhuggingface.co\u002Fallenai\u002FolmOCR-7B-0725-FP8)，在 [olmOCR-Bench](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench) 上得分提高了 3 分，同时由于默认使用 FP8 格式，运行速度显著加快，且每个文档所需的重试次数也大大减少。\n - 2025年7月23日 - v0.2.0 - 新的清理后的 [训练代码](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Ftrain)，使得自行训练 olmOCR 模型变得更加简单。\n - 2025年6月17日 - v0.1.75 - 从 sglang 切换到 vllm 基于的推理管道，更新 Docker 镜像至 CUDA 12.8。\n - 2025年5月23日 - v0.1.70 - 现已提供官方 Docker 支持及镜像！[查看 Docker 使用方法](#using-docker)\n - 2025年5月19日 - v0.1.68 - [olmOCR-Bench](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench) 正式发布，得分为 77.4。此次发布还包括因提示词方面的错误修复而带来的 olmOCR 流程性能提升 2 分。\n - 2025年3月17日 - v0.1.60 - 由于采样过程中温度选择更佳，性能有所提升。\n - 2025年2月25日 - v0.1.58 - 初次公开发布并推出演示。\n\n### 基准测试\n\n[**olmOCR-Bench**](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Ftree\u002Fmain\u002Folmocr\u002Fbench)：\n我们还提供一套全面的基准测试套件，涵盖 1,400 份文档中的 7,000 多个测试用例，以帮助评估 OCR 系统的性能。\n\n\u003Ctable>\n    \u003Cthead>\n        \u003Ctr>\n            \u003Cth>\u003C\u002Fth>\n            \u003Cth>ArXiv\u003C\u002Fth>\n            \u003Cth>旧数学扫描\u003C\u002Fth>\n            \u003Cth>表格\u003C\u002Fth>\n            \u003Cth>旧扫描\u003C\u002Fth>\n            \u003Cth>页眉与页脚\u003C\u002Fth>\n            \u003Cth>多栏\u003C\u002Fth>\n            \u003Cth>长而细小的文字\u003C\u002Fth>\n            \u003Cth>基础\u003C\u002Fth>\n            \u003Cth>总体\u003C\u002Fth>\n        \u003C\u002Ftr>\n    \u003C\u002Fthead>\n    \u003Ctbody>\n        \u003Ctr>\n            \u003Ctd>Mistral OCR API\u003C\u002Ftd>\n            \u003Ctd>77.2\u003C\u002Ftd>\n            \u003Ctd>67.5\u003C\u002Ftd>\n            \u003Ctd>60.6\u003C\u002Ftd>\n            \u003Ctd>29.3\u003C\u002Ftd>\n            \u003Ctd>93.6\u003C\u002Ftd>\n            \u003Ctd>71.3\u003C\u002Ftd>\n            \u003Ctd>77.1\u003C\u002Ftd>\n            \u003Ctd>99.4\u003C\u002Ftd>\n            \u003Ctd>72.0±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Marker 1.10.1\u003C\u002Ftd>\n            \u003Ctd>83.8\u003C\u002Ftd>\n            \u003Ctd>66.8\u003C\u002Ftd>\n            \u003Ctd>72.9\u003C\u002Ftd>\n            \u003Ctd>33.5\u003C\u002Ftd>\n            \u003Ctd>86.6\u003C\u002Ftd>\n            \u003Ctd>80.0\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>99.3\u003C\u002Ftd>\n            \u003Ctd>76.1±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>MinerU 2.5.4*\u003C\u002Ftd>\n            \u003Ctd>76.6\u003C\u002Ftd>\n            \u003Ctd>54.6\u003C\u002Ftd>\n            \u003Ctd>84.9\u003C\u002Ftd>\n            \u003Ctd>33.7\u003C\u002Ftd>\n            \u003Ctd>96.6\u003C\u002Ftd>\n            \u003Ctd>78.2\u003C\u002Ftd>\n            \u003Ctd>83.5\u003C\u002Ftd>\n            \u003Ctd>93.7\u003C\u002Ftd>\n            \u003Ctd>75.2±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>DeepSeek-OCR\u003C\u002Ftd>\n            \u003Ctd>77.2\u003C\u002Ftd>\n            \u003Ctd>73.6\u003C\u002Ftd>\n            \u003Ctd>80.2\u003C\u002Ftd>\n            \u003Ctd>33.3\u003C\u002Ftd>\n            \u003Ctd>96.1\u003C\u002Ftd>\n            \u003Ctd>66.4\u003C\u002Ftd>\n            \u003Ctd>79.4\u003C\u002Ftd>\n            \u003Ctd>99.8\u003C\u002Ftd>\n            \u003Ctd>75.7±1.0\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Nanonets-OCR2-3B\u003C\u002Ftd>\n            \u003Ctd>75.4\u003C\u002Ftd>\n            \u003Ctd>46.1\u003C\u002Ftd>\n            \u003Ctd>86.8\u003C\u002Ftd>\n            \u003Ctd>40.9\u003C\u002Ftd>\n            \u003Ctd>32.1\u003C\u002Ftd>\n            \u003Ctd>81.9\u003C\u002Ftd>\n            \u003Ctd>93.0\u003C\u002Ftd>\n            \u003Ctd>99.6\u003C\u002Ftd>\n            \u003Ctd>69.5±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>PaddleOCR-VL*\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>71.0\u003C\u002Ftd>\n            \u003Ctd>84.1\u003C\u002Ftd>\n            \u003Ctd>37.8\u003C\u002Ftd>\n            \u003Ctd>97.0\u003C\u002Ftd>\n            \u003Ctd>79.9\u003C\u002Ftd>\n            \u003Ctd>85.7\u003C\u002Ftd>\n            \u003Ctd>98.5\u003C\u002Ftd>\n            \u003Ctd>80.0±1.0\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Infinity-Parser 7B*\u003C\u002Ftd>\n            \u003Ctd>84.4\u003C\u002Ftd>\n            \u003Ctd>83.8\u003C\u002Ftd>\n            \u003Ctd>85.0\u003C\u002Ftd>\n            \u003Ctd>47.9\u003C\u002Ftd>\n            \u003Ctd>88.7\u003C\u002Ftd>\n            \u003Ctd>84.2\u003C\u002Ftd>\n            \u003Ctd>86.4\u003C\u002Ftd>\n            \u003Ctd>99.8\u003C\u002Ftd>\n            \u003Ctd>82.5±？\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Chandra OCR 0.1.0*\u003C\u002Ftd>\n            \u003Ctd>82.2\u003C\u002Ftd>\n            \u003Ctd>80.3\u003C\u002Ftd>\n            \u003Ctd>88.0\u003C\u002Ftd>\n            \u003Ctd>50.4\u003C\u002Ftd>\n            \u003Ctd>90.8\u003C\u002Ftd>\n            \u003Ctd>81.2\u003C\u002Ftd>\n            \u003Ctd>92.3\u003C\u002Ftd>\n            \u003Ctd>99.9\u003C\u002Ftd>\n            \u003Ctd>83.1±0.9\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd colspan=\"10\">\u003Chr>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>olmOCR v0.4.0\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>83.0\u003C\u002Ftd>\n            \u003Ctd>82.3\u003C\u002Ftd>\n            \u003Ctd>84.9\u003C\u002Ftd>\n            \u003Ctd>47.7\u003C\u002Ftd>\n            \u003Ctd>96.1\u003C\u002Ftd>\n            \u003Ctd>83.7\u003C\u002Ftd>\n            \u003Ctd>81.9\u003C\u002Ftd>\n            \u003Ctd>99.7\u003C\u002Ftd>\n            \u003Ctd>82.4±1.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n    \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n### 安装\n\n#### 系统依赖\n\n你需要安装 poppler-utils 和额外的字体，以便渲染 PDF 图像。\n\n安装依赖（Ubuntu\u002FDebian）：\n```bash\nsudo apt-get update\nsudo apt-get install poppler-utils ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools\n```\n\n#### Python 安装\n\n设置一个 conda 环境并安装 olmocr。运行 olmOCR 的依赖项在现有 Python 环境中安装起来比较困难，因此请务必创建一个干净的 Python 环境来进行安装。\n\n```bash\nconda create -n olmocr python=3.11\nconda activate olmocr\n```\n\n根据你的使用场景选择合适的安装选项：\n\n**选项 1：远程推理（轻量级）**\n\n如果你计划使用带有 `--server` 标志的远程 vLLM 服务器，请安装基础包：\n```bash\npip install olmocr\n```\n这样可以避免安装诸如 PyTorch 这样的大型 GPU 依赖库（约 2GB+）。\n\n**选项 2：本地 GPU 推理**\n\n要求：\n- 近期的 NVIDIA GPU（已在 RTX 4090、L40S、A100、H100 上测试过），且至少有 12 GB 的显存\n- 30 GB 的可用磁盘空间\n\n要在你自己的 GPU 上运行推理：\n```bash\npip install olmocr[gpu] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n\n# 推荐：安装 flash infer 以加速 GPU 上的推理\npip install https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\u002Fflashinfer\u002Fflashinfer_python-0.2.5%2Bcu128torch2.7-cp38-abi3-linux_x86_64.whl\n```\n\n**选项 3：Beaker 集群执行**\n\n如果要使用 `--beaker` 标志将任务提交到 Beaker 集群：\n```bash\npip install olmocr[beaker]\n```\n\n**选项 4：基准测试套件**\n\n如果要运行 olmOCR 基准测试套件：\n```bash\npip install olmocr[bench]\n```\n\n**组合安装**\n\n你可以结合多个选项：\n```bash\n# GPU + Beaker 支持\npip install olmocr[gpu,beaker] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n\n# GPU + 基准测试支持\npip install olmocr[gpu,bench] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n**故障排除**\n\n如果你遇到关于“打开文件数过多”的错误，请更新你的 ulimit：\n```bash\nulimit -n 65536\n```\n\n### 使用示例\n\n为了快速测试，可以尝试 [web 演示](https:\u002F\u002Folmocr.allen.ai\u002F)。\n\n**转换单个 PDF（本地 GPU）：**\n```bash\n# 下载一个示例 PDF\ncurl -o olmocr-sample.pdf https:\u002F\u002Folmocr.allenai.org\u002Fpapers\u002Folmocr_3pg_sample.pdf\n\n# 将其转换为 markdown\nolmocr .\u002Flocalworkspace --markdown --pdfs olmocr-sample.pdf\n```\n\n**转换图像文件：**\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs random_page.png\n```\n\n**转换多个 PDF：**\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf\n```\n\n**使用远程推理服务器：**\n```bash\nolmocr .\u002Flocalworkspace --server http:\u002F\u002Fremote-server:8000\u002Fv1 --model allenai\u002FolmOCR-2-7B-1025-FP8 --markdown --pdfs *.pdf\n```\n\n使用 `--markdown` 标志后，结果将以 markdown 文件的形式存储在 `.\u002Flocalworkspace\u002Fmarkdown\u002F` 目录下。\n\n> **注意：** 如果你喜欢，也可以使用 `python -m olmocr.pipeline` 来代替 `olmocr`。\n\n#### 查看结果\n\n此时，`.\u002Flocalworkspace\u002F` 工作目录下将同时包含 [Dolma](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) 和 markdown 文件（如果使用了 `--markdown`）。\n\n```bash\ncat localworkspace\u002Fmarkdown\u002Folmocr-sample.md \n```\n\n```\nolmOCR：利用视觉语言模型解锁 PDF 中的数万亿个 token\n...\n```\n\n### 使用推理提供商或外部服务器\n\n如果你已经在其他地方运行了一个 vLLM 服务器（或任何实现了 OpenAI API 的推理平台），你可以让 olmOCR 使用它，而不是启动本地实例。\n\n**远程推理的安装：**\n```bash\n# 轻量级安装——无需 GPU 依赖\npip install olmocr\n```\n\n**使用外部服务器：**\n```bash\n# 使用外部 vLLM 服务器代替本地服务器\nolmocr .\u002Flocalworkspace --server http:\u002F\u002Fremote-server:8000\u002Fv1 --model allenai\u002FolmOCR-2-7B-1025-FP8 --markdown --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf\n```\n\nvLLM 中提供的模型名称需要与 `--model` 参数中指定的值一致。\n\n**vLLM 服务器启动示例：**\n```bash\nvllm serve allenai\u002FolmOCR-2-7B-1025-FP8 --max-model-len 16384\n```\n\n#### 经验证的外部提供商\n\n我们已在以下外部模型提供商上测试了 `olmOCR-2-7B-1025-FP8`，并确认它们可以正常工作：\n\n|                                                                             | 每 100 万输入 token 的费用 | 每 100 万输出 token 的费用 | 示例命令                                                                                                                                                                |\n|-----------------------------------------------------------------------------|---------------------------|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Cirrascale](https:\u002F\u002Fai2endpoints.cirrascale.ai\u002Fmodels\u002Foverview)            | $0.07                   | $0.15                  | `olmocr .\u002Fworkspace --server https:\u002F\u002Fai2endpoints.cirrascale.ai\u002Fapi --api_key sk-XXXXXXX --workers 1 --max_concurrent_requests 20 --model olmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf`     |\n| [DeepInfra](https:\u002F\u002Fdeepinfra.com\u002F)                                         | $0.09                   | $0.19                  | `olmocr .\u002Fworkspace --server https:\u002F\u002Fapi.deepinfra.com\u002Fv1\u002Fopenai --api_key DfXXXXXXX --workers 1 --max_concurrent_requests 20 --model allenai\u002FolmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf` |\n| [Parasail](https:\u002F\u002Fwww.saas.parasail.io\u002Fserverless?name=olmocr-7b-1025-fp8) | $0.10                   | $0.20                  | `olmocr .\u002Fworkspace --server https:\u002F\u002Fapi.parasail.io\u002Fv1 --api_key psk-XXXXX --workers 1 --max_concurrent_requests 20 --model allenai\u002FolmOCR-2-7B-1025 --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf`          |\n\n\n参数说明：\n- `--server`：定义兼容 OpenAI 的端点，例如 `https:\u002F\u002Fapi.deepinfra.com\u002Fv1\u002Fopenai`。\n- `--api_key`：你的 API 密钥，通过 Authorization Bearer HTTP 头传递。\n- `--max_concurrent_requests`：一次最多可向推理提供商发送的并发请求数量。\n- `--workers`：一次最多可处理的页面组数。建议将其设置为 `1`，以便完成一组内容后再继续下一组。\n- `--pages_per_group`：由于许多外部提供商的并发请求限制较低，你可能希望减少每组的页数。\n- `--model`：模型标识符，例如 `allenai\u002FolmOCR-2-7B-1025`。不同的提供商可能有不同的名称；如果你在本地运行，则可以使用 `olmocr`。\n- 其他参数与本地推理时相同。\n\n### 多节点\u002F集群使用\n\n如果您希望使用多个并行运行的节点来转换数百万个 PDF 文件，olmOCR 支持从 AWS S3 读取 PDF，并使用 AWS S3 输出存储桶来协调工作。\n\n**启动第一个工作节点：**\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace --pdfs s3:\u002F\u002Fmy_s3_bucket\u002Fjakep\u002Fgnarly_pdfs\u002F*.pdf\n```\n\n这会在您的 AWS 存储桶中设置一个简单的任务队列，并开始转换 PDF 文件。\n\n**在后续的工作节点上：**\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace\n```\n\n这些节点会自动从同一个工作空间队列中获取任务并开始处理。\n\n#### 使用 Beaker 进行集群执行\n\n如果您在 Ai2 工作，并希望使用 [beaker](https:\u002F\u002Fwww.beaker.org) 高效地线性化数百万个 PDF 文件，请安装带有 Beaker 支持的版本：\n\n```bash\npip install olmocr[gpu,beaker] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n然后使用 `--beaker` 标志在本地准备工作空间，并在集群中启动 N 个 GPU 工作节点：\n\n```bash\nolmocr s3:\u002F\u002Fmy_s3_bucket\u002Fpdfworkspaces\u002Fexampleworkspace --pdfs s3:\u002F\u002Fmy_s3_bucket\u002Fjakep\u002Fgnarly_pdfs\u002F*.pdf --beaker --beaker_gpus 4\n```\n\n\n### 使用 Docker\n\n拉取 Docker 镜像（较大，包含模型，约 30GB）：\n```bash\ndocker pull alleninstituteforai\u002Folmocr:latest-with-model\n```\n\n对于希望自行管理模型下载的高级用户，我们还提供了不含模型的基础镜像：\n```bash\ndocker pull alleninstituteforai\u002Folmocr:latest\n```\n\n#### 快速入门 - 处理 PDF 文件\n\n处理当前目录中的单个 PDF 文件：\n```bash\ndocker run --gpus all \\\n  -v $(pwd):\u002Fworkspace \\\n  alleninstituteforai\u002Folmocr:latest-with-model \\\n  -c \"olmocr \u002Fworkspace\u002Foutput --markdown --pdfs \u002Fworkspace\u002Fsample.pdf\"\n```\n\n处理多个 PDF 文件：\n```bash\ndocker run --gpus all \\\n  -v \u002Fpath\u002Fto\u002Fpdfs:\u002Finput \\\n  -v \u002Fpath\u002Fto\u002Foutput:\u002Foutput \\\n  alleninstituteforai\u002Folmocr:latest-with-model \\\n  -c \"olmocr \u002Foutput --markdown --pdfs \u002Finput\u002F*.pdf\"\n```\n\n#### 交互模式\n\n以交互模式运行容器，便于探索和调试：\n```bash\ndocker run -it --gpus all alleninstituteforai\u002Folmocr:latest-with-model\n```\n\n> 更多信息请访问我们在 [Docker Hub](https:\u002F\u002Fhub.docker.com\u002Fr\u002Falleninstituteforai\u002Folmocr) 上的 Docker 仓库。\n\n### 完整文档\n\n查看所有可用选项：\n```bash\nolmocr --help\n用法：pipeline.py [-h] [--pdfs [PDFS ...]] [--model MODEL] [--workspace_profile WORKSPACE_PROFILE] [--pdf_profile PDF_PROFILE] [--pages_per_group PAGES_PER_GROUP] [--max_page_retries MAX_PAGE_RETRIES] [--max_page_error_rate MAX_PAGE_ERROR_RATE] [--workers WORKERS]\n                   [--apply_filter] [--stats] [--markdown] [--target_longest_image_dim TARGET_LONGEST_IMAGE_DIM] [--target_anchor_text_len TARGET_ANCHOR_TEXT_LEN] [--guided_decoding] [--gpu-memory-utilization GPU_MEMORY_UTILIZATION] [--max_model_len MAX_MODEL_LEN]\n                   [--tensor-parallel-size TENSOR_PARALLEL_SIZE] [--data-parallel-size DATA_PARALLEL_SIZE] [--port PORT] [--server SERVER] [--beaker] [--beaker_workspace BEAKER_WORKSPACE] [--beaker_cluster BEAKER_CLUSTER] [--beaker_gpus BEAKER_GPUS] [--beaker_priority BEAKER_PRIORITY]\n                   workspace\n\n用于通过批处理推理管道运行数百万个 PDF 文件的管理器\n\n位置参数：\n  workspace             用于存储工作的文件系统路径，可以是本地文件夹，也可以是与多个工作节点协作时使用的 S3 路径，例如 s3:\u002F\u002Fbucket\u002Fprefix\u002F\n\n选项：\n  -h, --help            显示此帮助消息并退出\n  --pdfs [PDFS ...]     将存储在 S3 中的 PDF 添加到工作空间的路径，可以是通配符路径 s3:\u002F\u002Fbucket\u002Fprefix\u002F*.pdf，或包含 PDF 路径列表的文件路径\n  --model MODEL         模型所在路径，默认为 allenai\u002FolmOCR-7B-0725-FP8，可以是本地路径、S3 或 Hugging Face。\n  --workspace_profile WORKSPACE_PROFILE\n                        用于访问工作空间的 S3 配置文件\n  --pdf_profile PDF_PROFILE\n                        用于访问原始 PDF 文档的 S3 配置文件\n  --pages_per_group PAGES_PER_GROUP\n                        每个工作项组的目标 PDF 页面数量\n  --max_page_retries MAX_PAGE_RETRIES\n                        我们将重试渲染页面的最大次数\n  --max_page_error_rate MAX_PAGE_ERROR_RATE\n                        文档中允许的失败页面比例，默认为 1\u002F250\n  --workers WORKERS     同时运行的工作节点数量\n  --apply_filter        对非表单且不太可能是 SEO 垃圾邮件的英文 PDF 应用基本过滤\n  --stats               不执行任何作业，而是报告当前工作空间的一些统计信息\n  --markdown            同时将自然文本写入 Markdown 文件，并保留输入 PDF 的文件夹结构\n  --target_longest_image_dim TARGET_LONGEST_IMAGE_DIM\n                        用于渲染 PDF 页面的最长边尺寸\n  --target_anchor_text_len TARGET_ANCHOR_TEXT_LEN\n                        可使用的锚文本最大长度（字符数），新模型不再使用此参数\n  --guided_decoding     启用针对模型 YAML 类型输出的引导解码功能\n\nVLLM 参数：\n  --gpu-memory-utilization GPU_MEMORY_UTILIZATION\n                        VLLM 可预先分配用于 KV 缓存的显存比例（传递给 vllm serve）。\n  --max_model_len MAX_MODEL_LEN\n                        VLLM 将为其分配 KV 缓存的最大标记数上限，如果低于此值，VLLM 将不会启动\n  --tensor-parallel-size TENSOR_PARALLEL_SIZE, -tp TENSOR_PARALLEL_SIZE\n                        VLLM 的张量并行规模\n  --data-parallel-size DATA_PARALLEL_SIZE, -dp DATA_PARALLEL_SIZE\n                        VLLM 的数据并行规模\n  --port PORT           VLLM 服务器使用的端口\n  --server SERVER       外部 VLLM（或其他兼容提供商）的 URL\n                        服务器地址（例如 http:\u002F\u002Fhostname:port）。如果提供此选项，\n                        则跳过本地 VLLM 实例的启动\n\nBeaker\u002F集群执行：\n  --beaker              将此作业提交到 Beaker，而不是在本地运行\n  --beaker_workspace BEAKER_WORKSPACE\n                        要提交到的 Beaker 工作空间\n  --beaker_cluster BEAKER_CLUSTER\n                        您希望在其上运行的 Beaker 集群\n  --beaker_gpus BEAKER_GPUS\n                        要运行的 GPU 副本数量\n  --beaker_priority BEAKER_PRIORITY\n                        该作业的 Beaker 优先级级别\n```\n\n## 代码概览\n\n这里有一些不错的可重用代码片段，可能对您的项目有所帮助：\n- 使用 ChatGPT 4o 实现高质量自然文本解析的提示策略 - [buildsilver.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fdata\u002Fbuildsilver.py)\n- 基于语言的基本过滤及 SEO 垃圾信息去除 - [filter.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ffilter\u002Ffilter.py)\n- Qwen2.5-VL 的 SFT 微调代码 - [train.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ftrain\u002Ftrain.py)\n- GRPO 强化学习训练器 - [grpo_train.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Ftrain\u002Fgrpo_train.py)\n- 合成数据生成 - [mine_html_templates.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fsynth\u002Fmine_html_templates.py)\n- 使用 VLLM 和微调模型处理数百万份 PDF 文件 - [pipeline.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fpipeline.py)\n- 查看由 PDF 文件生成的 [Dolma 文档](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) - [dolmaviewer.py](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002Folmocr\u002Fviewer\u002Fdolmaviewer.py)\n\n\n\n## 团队\n\n\u003C!-- start team -->\n\n**olmOCR** 由 AllenNLP 团队开发并维护，背后支持机构是 [艾伦人工智能研究所 (AI2)](https:\u002F\u002Fallenai.org\u002F)。\nAI2 是一家非营利性研究机构，其使命是通过具有重大影响力的 AI 研究与工程为人类社会作出贡献。\n如需了解具体为该代码库做出贡献的人员，请参阅我们的 [贡献者页面](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fgraphs\u002Fcontributors)。\n\n\u003C!-- end team -->\n\n## 许可证\n\n\u003C!-- start license -->\n\n**olmOCR** 采用 [Apache 2.0 许可证](https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0)授权。\n许可证全文可在 [GitHub](https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fblob\u002Fmain\u002FLICENSE) 上找到。\n\n\u003C!-- end license -->\n\n## 引用\n\n针对 olmOCR v1 和 OlmOCR-bench：\n```bibtex\n@misc{olmocrbench,\n      title={{olmOCR：利用视觉语言模型解锁 PDF 中的数万亿个 token}},\n      author={杰克·波兹南斯基、乔恩·博尔查特、杰森·邓克尔伯格、里根·哈夫、丹尼尔·林、阿曼·兰加普尔、克里斯托弗·维尔海姆、凯尔·洛、卢卡·索尔代尼},\n      year={2025},\n      eprint={2502.18443},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.18443},\n}\n```\n\n针对 olmOCR v2 的 RL 单元测试奖励机制：\n```bibtex\n@misc{olmocr2,\n      title={olmOCR 2：用于文档 OCR 的单元测试奖励机制}, \n      author={杰克·波兹南斯基、卢卡·索尔代尼、凯尔·洛},\n      year={2025},\n      eprint={2510.19817},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.19817}, \n}\n```","# olmOCR 快速上手指南\n\nolmOCR 是一个基于视觉语言模型（VLM）的开源工具，旨在将 PDF、PNG、JPEG 等文档转换为干净、可读的 Markdown 文本。它擅长处理公式、表格、手写体及复杂排版（如多栏布局），并能自动去除页眉页脚。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux (推荐 Ubuntu\u002FDebian)\n- **GPU (本地推理)**: NVIDIA GPU (RTX 4090, L40S, A100, H100 等)，显存至少 12GB\n- **磁盘空间**: 至少 30GB 可用空间\n- **Python 版本**: 3.11\n\n### 前置依赖\n在安装 Python 包之前，需先安装系统级依赖（用于 PDF 渲染和字体支持）：\n\n```bash\nsudo apt-get update\nsudo apt-get install poppler-utils ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools\n```\n\n> **提示**: 若遇到 `too many open files` 错误，请执行 `ulimit -n 65536` 增加文件描述符限制。\n\n## 安装步骤\n\n建议创建独立的 Conda 环境以避免依赖冲突：\n\n```bash\nconda create -n olmocr python=3.11\nconda activate olmocr\n```\n\n根据使用场景选择以下一种安装方式：\n\n### 方案 A：本地 GPU 推理（推荐）\n适用于拥有高性能 NVIDIA 显卡的用户。\n\n```bash\n# 安装带有 GPU 支持的版本 (CUDA 12.8)\npip install olmocr[gpu] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n\n# (可选) 安装 flash infer 以加速推理\npip install https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\u002Fflashinfer\u002Fflashinfer_python-0.2.5%2Bcu128torch2.7-cp38-abi3-linux_x86_64.whl\n```\n\n### 方案 B：远程推理（轻量级）\n适用于无本地 GPU，计划连接远程 vLLM 服务器或云服务的用户。此方式无需安装庞大的 PyTorch 依赖。\n\n```bash\npip install olmocr\n```\n\n### 方案 C：组合安装\n如需同时支持 Beaker 集群或基准测试：\n\n```bash\n# GPU + Beaker 支持\npip install olmocr[gpu,beaker] --extra-index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n## 基本使用\n\n### 1. 转换单个 PDF 文件（本地 GPU）\n下载示例文件并转换为 Markdown：\n\n```bash\n# 下载示例 PDF\ncurl -o olmocr-sample.pdf https:\u002F\u002Folmocr.allenai.org\u002Fpapers\u002Folmocr_3pg_sample.pdf\n\n# 执行转换，结果保存在 .\u002Flocalworkspace\u002Fmarkdown\u002F 目录\nolmocr .\u002Flocalworkspace --markdown --pdfs olmocr-sample.pdf\n```\n\n### 2. 转换图片文件\n支持直接转换 PNG 或 JPEG 图片：\n\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs random_page.png\n```\n\n### 3. 批量转换\n支持通配符批量处理文件夹内的所有 PDF：\n\n```bash\nolmocr .\u002Flocalworkspace --markdown --pdfs tests\u002Fgnarly_pdfs\u002F*.pdf\n```\n\n### 4. 使用远程服务器推理\n如果你没有本地 GPU，可以连接到外部 vLLM 服务（需先安装方案 B）：\n\n```bash\nolmocr .\u002Flocalworkspace --server http:\u002F\u002Fremote-server:8000\u002Fv1 --model allenai\u002FolmOCR-2-7B-1025-FP8 --markdown --pdfs *.pdf\n```\n\n### 查看结果\n转换完成后，Markdown 文件位于工作区的 `markdown` 子目录下：\n\n```bash\ncat localworkspace\u002Fmarkdown\u002Folmocr-sample.md\n```","某科研团队正致力于构建一个垂直领域的法律大模型，需要清洗并结构化数万份包含复杂排版、双栏布局及手写批注的扫描版 PDF 判决书作为训练数据。\n\n### 没有 olmocr 时\n- **阅读顺序混乱**：传统 OCR 工具无法识别双栏排版，导致提取的文本左右列内容交错混杂，完全丧失语义连贯性。\n- **关键信息丢失**：遇到数学公式、复杂表格或手写注释时，系统往往将其忽略或转换为乱码，造成训练数据出现严重“知识空洞”。\n- **噪音干扰严重**：页眉、页脚及页码被重复提取，混入正文中，后续需要编写大量正则规则进行人工清洗，耗时且易出错。\n- **格式还原度低**：输出的纯文本缺乏结构标记（如 Markdown），无法直接用于现代 LLM 的训练流程，需额外开发解析脚本。\n\n### 使用 olmocr 后\n- **自然阅读流重建**：olmocr 基于视觉语言模型智能分析版面，自动将双栏、插图环绕等复杂布局重组为符合人类阅读习惯的线性文本。\n- **全要素高保真转换**：无论是复杂的法律统计表格、嵌入的公式还是边缘的手写批注，olmocr 均能精准识别并转换为标准的 Markdown 格式。\n- **智能去噪处理**：工具自动检测并剔除页眉、页脚等无关元素，直接输出纯净的正文内容，省去了繁琐的后处理清洗环节。\n- **即插即用的高效流水线**：直接生成高质量的 Markdown 数据集，无缝对接下游训练任务，将原本数周的数据预处理工作缩短至数小时。\n\nolmocr 通过将非结构化的复杂文档瞬间转化为大模型可理解的高质量语料，彻底解决了领域数据“有书难读、有字难用”的瓶颈。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_olmocr_719b7d21.png","allenai","Ai2","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fallenai_65c450d5.png","",null,"ai2-info@allenai.org","http:\u002F\u002Fwww.allenai.org","https:\u002F\u002Fgithub.com\u002Fallenai",[84,88,92,96,100],{"name":85,"color":86,"percentage":87},"Python","#3572A5",86.5,{"name":89,"color":90,"percentage":91},"Shell","#89e051",8.7,{"name":93,"color":94,"percentage":95},"HTML","#e34c26",4.7,{"name":97,"color":98,"percentage":99},"Dockerfile","#384d54",0.1,{"name":101,"color":102,"percentage":103},"Makefile","#427819",0,17101,1372,"2026-04-04T21:43:17","Apache-2.0","Linux","本地推理必需：NVIDIA GPU (测试型号：RTX 4090, L40S, A100, H100)，显存至少 12GB，CUDA 12.8","未说明",{"notes":112,"python":113,"dependencies":114},"1. 系统依赖：需安装 poppler-utils 及额外字体（如 ttf-mscorefonts-installer 等）以渲染 PDF。2. 环境管理：强烈建议使用 conda 创建干净的 Python 3.11 环境，避免依赖冲突。3. 运行模式：支持本地 GPU 推理、远程 vLLM 服务器推理（轻量级安装，无需本地 GPU）以及 Beaker 集群执行。4. 磁盘空间：本地 GPU 推理需要至少 30GB 可用磁盘空间。5. 系统限制：若遇到'too many open files'错误，需将 ulimit 设置为 65536。","3.11",[115,116,117,118],"poppler-utils","torch (cu128)","vllm","flashinfer (可选，用于加速)",[14,34,37],7,"2026-03-27T02:49:30.150509","2026-04-06T06:53:15.716038",[124,129,134,139,144,148],{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},9445,"运行管道时遇到 'WARNING - Attempt *: All connection attempts failed' 错误怎么办？","这通常是因为系统 Python 环境中存在依赖冲突，导致安装的包版本与预期不符。建议创建一个干净的 Conda 环境来运行项目，以确保依赖项的一致性。\n\n解决步骤：\n1. 安装 Miniconda（如果尚未安装）：https:\u002F\u002Fwww.anaconda.com\u002Fdocs\u002Fgetting-started\u002Fminiconda\u002Fmain\n2. 创建并激活新环境：\n   ```bash\n   conda create -n olmocr python=3.11\n   conda activate olmocr\n   ```\n3. 在新环境中重新安装项目依赖。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fissues\u002F88",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},9446,"处理多个 PDF 时出现 '[Errno 110] Connect call failed' 或连接超时错误如何解决？","该错误通常是因为 SGLang 服务器默认只监听本地接口，导致外部或多进程连接失败。需要修改代码让服务器监听所有网络接口。\n\n解决方法：\n编辑 `olmocr\u002Folmocr\u002Fpipeline.py` 文件，找到启动 `sglang.launch_server` 的命令部分，添加 `--host 0.0.0.0` 参数。修改后的代码片段如下：\n\n```python\ncmd = [ \n     \"python3\", \n     \"-m\", \n     \"sglang.launch_server\", \n     \"--model-path\", \n     model_name_or_path, \n     \"--chat-template\", \n     args.model_chat_template, \n     \"--port\", \n     str(SGLANG_SERVER_PORT), \n     \"--log-level-http\", \n     \"warning\", \n     \"--host\", # 新增行\n     \"0.0.0.0\", # 新增行，允许外部访问\n ] \n```\n保存后重新运行即可。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fissues\u002F131",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},9447,"在 Docker 或 Singularity 容器中运行时报错 'No module named olmocr.pipeline' 怎么办？","这是因为容器内的 Python 路径未正确包含项目根目录。可以通过设置环境变量 `PYTHONPATH` 来解决。\n\n解决方法：\n在执行命令前，导出 PYTHONPATH 变量指向根目录（通常是 `\u002Froot`）：\n\n```bash\nexport PYTHONPATH=\"\u002Froot:$PYTHONPATH\"\n```\n\n设置完成后，即可正常运行：\n```bash\npython -m olmocr.pipeline .\u002Flocalworkspace --markdown --pdfs your_file.pdf\n```\n注：最新版本（v0.1.76+）的 Docker 镜像已修复此问题，无需手动设置。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fissues\u002F231",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},9448,"启动 pipeline 时 SGLang 服务器一直提示 'Please wait for sglang server to become ready...' 或直接退出怎么办？","这通常表示 SGLang 服务器启动失败或被意外取消。请检查以下几点：\n1. 确认显存充足：模型加载需要较大的 GPU 显存，显存不足会导致服务器启动失败。\n2. 检查端口占用：确保 `SGLANG_SERVER_PORT` 对应的端口未被其他程序占用。\n3. 查看完整日志：服务器启动时的具体报错信息通常在日志的前几行，可能包含 CUDA 错误或模型加载失败的详细信息。\n4. 尝试重启：有时临时性的资源锁定会导致失败，重试一次可能解决问题。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\u002Fissues\u002F129",{"id":145,"question_zh":146,"answer_zh":147,"source_url":128},9449,"如何验证 pdftoppm 是否已正确安装并可用？","olmocr 依赖 `pdftoppm` (poppler-utils) 来处理 PDF 文件。启动 pipeline 时，系统会自动检查该工具。\n\n如果日志中出现 `INFO:olmocr.check:pdftoppm is installed and working.`，说明安装正常。\n\n如果未安装或报错，请在 Linux\u002FUbuntu 系统上运行以下命令安装：\n```bash\nsudo apt-get update\nsudo apt-get install poppler-utils\n```\n安装完成后重新运行 pipeline 即可。",{"id":149,"question_zh":150,"answer_zh":151,"source_url":128},9450,"如何指定特定的 PDF 文件进行转换？","使用 `--pdfs` 参数后跟文件路径即可。支持单个文件或通配符。\n\n示例命令：\n```bash\npython -m olmocr.pipeline .\u002Flocalworkspace --pdfs \u002Fpath\u002Fto\u002Fyour\u002Fdocument.pdf\n```\n\n如果要处理多个文件，可以使用通配符：\n```bash\npython -m olmocr.pipeline .\u002Flocalworkspace --pdfs \u002Fpath\u002Fto\u002Fpdfs\u002F*.pdf\n```\n其中 `.\u002Flocalworkspace` 是工作目录，用于存储中间文件和结果。",[153,158,163,168,173,178,183,188,193,198,203,208,213,218,223,228,233,238,243,248],{"id":154,"version":155,"summary_zh":156,"released_at":157},106858,"v0.4.27","## What's new\n\n\n\n## Commits\n\n1e139a5 Bump version to v0.4.27 for release\n3c0ff52 Version bump\n19a1b90 Formatting fixes\n7eba43c Merge pull request #441 from allenai\u002Fgpu-deps\n302d37c Fixing a few lint errors, and queue bug in long queues\n7277bfc Updating readme\n7c00ac7 Fixing issue in tagging pipeline\n\n","2026-03-12T16:39:28",{"id":159,"version":160,"summary_zh":161,"released_at":162},106859,"v0.4.25","## What's new\n\n\n\n## Commits\n\n51d7d43 Bump version to v0.4.25 for release\n4f8815c Faster rich pii tagging pipeline\n\n","2026-01-25T02:58:26",{"id":164,"version":165,"summary_zh":166,"released_at":167},106860,"v0.4.24","## What's new\n\n\n\n## Commits\n\n84959a9 Bump version to v0.4.24 for release\nf516144 0.4.24\n0315003 PII Pipeline fixes\n5e9b1a3 Larger timeouts\n\n","2026-01-23T21:57:59",{"id":169,"version":170,"summary_zh":171,"released_at":172},106861,"v0.4.21","## What's new\n\n\n\n## Commits\n\n84eb4d8 Bump version to v0.4.21 for release\nb35bcb5 Version bump with pii tagging scripts\nc275a2e Lints\n9714a30 Un-bit-rotting pii tagging\n606b9f8 Merging and deleting the first 5000 chars tagger\n16ba667 Updating beaker spec\n77624c4 Tagging pipeline fix\n\n","2026-01-23T17:35:29",{"id":174,"version":175,"summary_zh":176,"released_at":177},106862,"v0.4.20","## What's new\n\n\n\n## Commits\n\nc262b85 Bump version to v0.4.20 for release\ne79337c Bumping version to rebuild docker images\n\n","2026-01-20T21:10:55",{"id":179,"version":180,"summary_zh":181,"released_at":182},106863,"v0.4.19","## What's new\n\n\n\n## Commits\n\ncf1b2b1 Bump version to v0.4.19 for release\n4fb2215 Kill server if backoff fails\n\n","2026-01-20T20:45:53",{"id":184,"version":185,"summary_zh":186,"released_at":187},106864,"v0.4.18","## What's new\n\n\n\n## Commits\n\n9292f0b Bump version to v0.4.18 for release\ned6ad8f Formatting fixes\n\n","2026-01-20T19:53:19",{"id":189,"version":190,"summary_zh":191,"released_at":192},106865,"v0.4.16","## What's new\n\n\n\n## Commits\n\n238708f Bump version to v0.4.16 for release\n1ec220d Small cleanup\n619e4d2 New version with parallel retries\nd7fd23d Merge branch 'jakep\u002Fparallel_retry'\n\n","2026-01-12T17:43:27",{"id":194,"version":195,"summary_zh":196,"released_at":197},106866,"v0.4.15","## What's new\n\n\n\n## Commits\n\na70f7b2 Bump version to v0.4.15 for release\n5a24231 Making the work_queue a bit more robust with timeouts to be used on giant shared filesystems\n2f91f48 Cleaning up the stats a bit\n76cf93e Dolma viewer targzs\n\n","2026-01-09T20:25:44",{"id":199,"version":200,"summary_zh":201,"released_at":202},106867,"v0.4.14","## What's new\n\n\n\n## Commits\n\ne888511 Bump version to v0.4.14 for release\n4d6cdf7 Lints fixed\n\n","2026-01-08T22:19:44",{"id":204,"version":205,"summary_zh":206,"released_at":207},106868,"v0.4.12","## What's new\n\n\n\n## Commits\n\n7ce773d Bump version to v0.4.12 for release\n995299c One more change to allow configurable timeout, which we need on some slower clusters\n\n","2025-12-10T23:25:08",{"id":209,"version":210,"summary_zh":211,"released_at":212},106869,"v0.4.11","## What's new\n\n\n\n## Commits\n\na05a283 Bump version to v0.4.11 for release\na2489c7 Changing how disk logging is configured, so that we can manage disk usage\n\n","2025-12-10T19:29:32",{"id":214,"version":215,"summary_zh":216,"released_at":217},106870,"v0.4.10","## What's new\n\n\n\n## Commits\n\ndd9f1f4 Bump version to v0.4.10 for release\n17e075b One more fix for .tar.gz paths\n\n","2025-12-09T22:57:02",{"id":219,"version":220,"summary_zh":221,"released_at":222},106871,"v0.4.9","## What's new\n\n\n\n## Commits\n\n23308c2 Bump version to v0.4.9 for release\n7ac8aed Version bump to fix release script issue\n\n","2025-12-09T22:00:27",{"id":224,"version":225,"summary_zh":226,"released_at":227},106872,"v0.4.7","## What's new\n\n\n\n## Commits\n\n6ae43d4 Bump version to v0.4.7 for release\n9ce1009 Bump version\n2b45b46 Having to bump transformers to match new vlm 0.11.2\nde05a98 Fixes #391\nc9b06f2 Upping to latest vllm to hopefully fix bug under priority scheduling\ne99fb07 Better docker docs\n\n","2025-12-01T21:18:51",{"id":229,"version":230,"summary_zh":231,"released_at":232},106873,"v0.4.6","## What's new\n\n\n\n## Commits\n\nb5eeae9 Bump version to v0.4.6 for release\n916d5a9 New version\n4dd7d12 Checking out how to clean up our docker story to be easier to use\n\n","2025-11-17T20:03:49",{"id":234,"version":235,"summary_zh":236,"released_at":237},106874,"v0.4.5","## What's new\n\n\n\n## Commits\n\n1ce2a6f Bump version to v0.4.5 for release\ne51c6f2 Even cleaner docs\n8272181 Fixing docs for #388\n9ee8c09 Formatting fixes and new version\neb4514a Temporary Fix for #383\n1987422 Update grpo_train.py\nf2bd40e Update README.md\n88d66c6 Update README.md\n\n","2025-11-15T00:04:49",{"id":239,"version":240,"summary_zh":241,"released_at":242},106875,"v0.4.4","## What's new\n\n\n\n## Commits\n\n522e8f2 Bump version to v0.4.4 for release\nab856cd Release bump\n939e85f FIxing up pipeline to be more reliable in terms of max concurrent requests\nf53e221 Better semaphore handling for larger jobs\ne9a3e48 Lints\n070e110 Some plot fixes\n8a6866e Fixing up some plots for a presentation\n\n","2025-11-04T19:51:54",{"id":244,"version":245,"summary_zh":246,"released_at":247},106876,"v0.4.3","## What's new\n\n\n\n## Commits\n\n3990b94 Bump version to v0.4.3 for release\n419b576 Version bump\na39ca53 Merge branch 'jakep\u002Fpriority_scheduler'\ne95aaed Fixing issue which likely corrects #371\ne1e3d5b README for finetuning\nec1bf24 Removing $ inline math from dolma viewer script, it's not reliable and our models don't output that format anymore\n3d2c977 Merge branch 'jakep\u002Florafix'\n41bee1e Update README.md\n4768db6 Fixes to train.py\n91962d6 Example finetuning config\nc62e221 Adding init file in data\n4ee2005 Adding a flag to run_benchmark script\n579e52a Adding Cirrascale as inference provider\n247d51d Updating deepinfra pricing\n10ab6a6 Adding suppor for smaller error bars in benchmarking\n15496b9 Infrapartner benchmarking script\n2d2c2c9 Adjusted table\n7d551ec Cleanup bench results table\n7c5a385 Copy over results table to main readme\n2c90e6a More readme updated with paper benchmark scores\n53be91a Add citations and arxiv paper links\nab108a5 Lint fixes\n210389f Merge branch 'main' of https:\u002F\u002Fgithub.com\u002Fallenai\u002Folmocr\n5083967 Cleaning up repo to move all unit tests to a consistent place\n\n","2025-10-31T17:58:50",{"id":249,"version":250,"summary_zh":251,"released_at":252},106877,"v0.4.2","## What's new\n\n\n\n## Commits\n\nf5fad40 Bump version to v0.4.2 for release\nee37a6a Updating tests and a few CI fixes\n\n","2025-10-22T05:05:01"]