[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-clovaai--donut":3,"tool-clovaai--donut":61},[4,18,28,37,45,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":24,"last_commit_at":25,"category_tags":26,"status":17},9989,"n8n","n8n-io\u002Fn8n","n8n 是一款面向技术团队的公平代码（fair-code）工作流自动化平台，旨在让用户在享受低代码快速构建便利的同时，保留编写自定义代码的灵活性。它主要解决了传统自动化工具要么过于封闭难以扩展、要么完全依赖手写代码效率低下的痛点，帮助用户轻松连接 400 多种应用与服务，实现复杂业务流程的自动化。\n\nn8n 特别适合开发者、工程师以及具备一定技术背景的业务人员使用。其核心亮点在于“按需编码”：既可以通过直观的可视化界面拖拽节点搭建流程，也能随时插入 JavaScript 或 Python 代码、调用 npm 包来处理复杂逻辑。此外，n8n 原生集成了基于 LangChain 的 AI 能力，支持用户利用自有数据和模型构建智能体工作流。在部署方面，n8n 提供极高的自由度，支持完全自托管以保障数据隐私和控制权，也提供云端服务选项。凭借活跃的社区生态和数百个现成模板，n8n 让构建强大且可控的自动化系统变得简单高效。",184740,2,"2026-04-19T23:22:26",[16,14,13,15,27],"插件",{"id":29,"name":30,"github_repo":31,"description_zh":32,"stars":33,"difficulty_score":10,"last_commit_at":34,"category_tags":35,"status":17},10095,"AutoGPT","Significant-Gravitas\u002FAutoGPT","AutoGPT 是一个旨在让每个人都能轻松使用和构建 AI 的强大平台，核心功能是帮助用户创建、部署和管理能够自动执行复杂任务的连续型 AI 智能体。它解决了传统 AI 应用中需要频繁人工干预、难以自动化长流程工作的痛点，让用户只需设定目标，AI 即可自主规划步骤、调用工具并持续运行直至完成任务。\n\n无论是开发者、研究人员，还是希望提升工作效率的普通用户，都能从 AutoGPT 中受益。开发者可利用其低代码界面快速定制专属智能体；研究人员能基于开源架构探索多智能体协作机制；而非技术背景用户也可直接选用预置的智能体模板，立即投入实际工作场景。\n\nAutoGPT 的技术亮点在于其模块化“积木式”工作流设计——用户通过连接功能块即可构建复杂逻辑，每个块负责单一动作，灵活且易于调试。同时，平台支持本地自托管与云端部署两种模式，兼顾数据隐私与使用便捷性。配合完善的文档和一键安装脚本，即使是初次接触的用户也能在几分钟内启动自己的第一个 AI 智能体。AutoGPT 正致力于降低 AI 应用门槛，让人人都能成为 AI 的创造者与受益者。",183572,"2026-04-20T04:47:55",[13,36,27,14,15],"语言模型",{"id":38,"name":39,"github_repo":40,"description_zh":41,"stars":42,"difficulty_score":10,"last_commit_at":43,"category_tags":44,"status":17},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,"2026-04-05T11:01:52",[14,15,13],{"id":46,"name":47,"github_repo":48,"description_zh":49,"stars":50,"difficulty_score":24,"last_commit_at":51,"category_tags":52,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",161692,"2026-04-20T11:33:57",[14,13,36],{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":24,"last_commit_at":59,"category_tags":60,"status":17},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":76,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":10,"env_os":89,"env_gpu":90,"env_ram":89,"env_deps":91,"category_tags":100,"github_topics":102,"view_count":24,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":109,"updated_at":110,"faqs":111,"releases":141},10233,"clovaai\u002Fdonut","donut","Official Implementation of OCR-free Document Understanding Transformer (Donut) and Synthetic Document Generator (SynthDoG), ECCV 2022","Donut（Document Understanding Transformer）是一款创新的开源 AI 模型，专为智能文档理解而设计。它彻底改变了传统处理流程，无需依赖任何现成的 OCR（光学字符识别）引擎或 API，即可直接端到端地从文档图像中提取结构化信息。\n\n长期以来，文档自动化处理往往受限于 OCR 环节的误差传递，且在面对复杂版式或多语言场景时表现不稳定。Donut 通过引入无 OCR 的 Transformer 架构，直接将图像映射为文本序列，有效解决了这一痛点。它在文档分类、信息抽取（如发票解析、票据识别）等任务上达到了业界领先的准确率。此外，项目配套的 SynthDoG 合成数据生成器，能灵活生成多语言、多领域的训练数据，进一步提升了模型在少样本场景下的泛化能力。\n\n这款工具非常适合人工智能开发者、学术研究人员以及需要构建高精度文档自动化系统的企业技术团队使用。无论是希望复现前沿论文成果的学者，还是致力于优化财务、物流等领域单据处理流程的工程师，Donut 都提供了预训练模型、详细的代码实现以及便捷的 Web 演示环境，帮助大家轻松上手并探索视觉文档理解的无限可能。","\u003Cdiv align=\"center\">\n    \n# Donut 🍩 : Document Understanding Transformer\n\n[![Paper](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper-arxiv.2111.15664-red)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664)\n[![Conference](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FECCV-2022-blue)](#how-to-cite)\n[![Demo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Gradio-brightgreen)](#demo)\n[![Demo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Colab-orange)](#demo)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdonut-python?color=green&label=pip%20install%20donut-python)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python)\n[![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_18a0a56d95e5.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdonut-python)\n\nOfficial Implementation of Donut and SynthDoG | [Paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664) | [Slide](https:\u002F\u002Fdocs.google.com\u002Fpresentation\u002Fd\u002F1gv3A7t4xpwwNdpxV_yeHzEOMy-exJCAz6AlAI9O5fS8\u002Fedit?usp=sharing) | [Poster](https:\u002F\u002Fdocs.google.com\u002Fpresentation\u002Fd\u002F1m1f8BbAm5vxPcqynn_MbFfmQAlHQIR5G72-hQUFS2sk\u002Fedit?usp=sharing)\n\n\u003C\u002Fdiv>\n\n## Introduction\n\n**Donut** 🍩, **Do**cume**n**t **u**nderstanding **t**ransformer, is a new method of document understanding that utilizes an OCR-free end-to-end Transformer model. Donut does not require off-the-shelf OCR engines\u002FAPIs, yet it shows state-of-the-art performances on various visual document understanding tasks, such as visual document classification or information extraction (a.k.a. document parsing). \nIn addition, we present **SynthDoG** 🐶, **Synth**etic **Do**cument **G**enerator, that helps the model pre-training to be flexible on various languages and domains.\n\nOur academic paper, which describes our method in detail and provides full experimental results and analyses, can be found here:\u003Cbr>\n> [**OCR-free Document Understanding Transformer**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664).\u003Cbr>\n> [Geewook Kim](https:\u002F\u002Fgeewook.kim), [Teakgyu Hong](https:\u002F\u002Fdblp.org\u002Fpid\u002F183\u002F0952.html), [Moonbin Yim](https:\u002F\u002Fgithub.com\u002Fmoonbings), [JeongYeon Nam](https:\u002F\u002Fgithub.com\u002Flong8v), [Jinyoung Park](https:\u002F\u002Fgithub.com\u002Fjyp1111), [Jinyeong Yim](https:\u002F\u002Fjinyeong.github.io), [Wonseok Hwang](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=M13_WdcAAAAJ), [Sangdoo Yun](https:\u002F\u002Fsangdooyun.github.io), [Dongyoon Han](https:\u002F\u002Fdongyoonhan.github.io), [Seunghyun Park](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=iowjmTwAAAAJ). In ECCV 2022.\n\n\u003Cimg width=\"946\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_9c9980a62787.png\">\n\n## Pre-trained Models and Web Demos\n\nGradio web demos are available! [![Demo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Gradio-brightgreen)](#demo) [![Demo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Colab-orange)](#demo)\n|:--:|\n|![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_5c12f735c6fb.png)|\n- You can run the demo with `.\u002Fapp.py` file.\n- Sample images are available at `.\u002Fmisc` and more receipt images are available at [CORD dataset link](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fcord-v2).\n- Web demos are available from the links in the following table.\n- Note: We have updated the Google Colab demo (as of June 15, 2023) to ensure its proper working.\n\n|Task|Sec\u002FImg|Score|Trained Model|\u003Cdiv id=\"demo\">Demo\u003C\u002Fdiv>|\n|---|---|---|---|---|\n| [CORD](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fcord) (Document Parsing)   |   0.7 \u002F\u003Cbr> 0.7 \u002F\u003Cbr> 1.2   |  91.3 \u002F\u003Cbr> 91.1 \u002F\u003Cbr> 90.9    | [donut-base-finetuned-cord-v2](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2\u002Ftree\u002Fofficial) (1280) \u002F\u003Cbr> [donut-base-finetuned-cord-v1](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1\u002Ftree\u002Fofficial) (1280) \u002F\u003Cbr> [donut-base-finetuned-cord-v1-2560](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1-2560\u002Ftree\u002Fofficial) | [gradio space web demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2),\u003Cbr>[google colab demo (updated at 23.06.15)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NMSqoIZ_l39wyRD7yVjw2FIuU2aglzJi?usp=sharing) |\n| [Train Ticket](https:\u002F\u002Fgithub.com\u002Fbeacandler\u002FEATEN) (Document Parsing)   |   0.6   |  98.7    | [donut-base-finetuned-zhtrainticket](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-zhtrainticket\u002Ftree\u002Fofficial) | [google colab demo (updated at 23.06.15)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1YJBjllahdqNktXaBlq5ugPh1BCm8OsxI?usp=sharing) |\n| [RVL-CDIP](https:\u002F\u002Fwww.cs.cmu.edu\u002F~aharley\u002Frvl-cdip) (Document Classification)     |  0.75   |   95.3      | [donut-base-finetuned-rvlcdip](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-rvlcdip\u002Ftree\u002Fofficial) | [gradio space web demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-rvlcdip),\u003Cbr>[google colab demo (updated at 23.06.15)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1iWOZHvao1W5xva53upcri5V6oaWT-P0O?usp=sharing) |\n| [DocVQA Task1](https:\u002F\u002Frrc.cvc.uab.es\u002F?ch=17) (Document VQA) |  0.78       | 67.5 | [donut-base-finetuned-docvqa](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-docvqa\u002Ftree\u002Fofficial) | [gradio space web demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-docvqa),\u003Cbr>[google colab demo (updated at 23.06.15)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1oKieslZCulFiquequ62eMGc-ZWgay4X3?usp=sharing) |\n\nThe links to the pre-trained backbones are here:\n- [`donut-base`](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base\u002Ftree\u002Fofficial): trained with 64 A100 GPUs (~2.5 days), number of layers (encoder: {2,2,14,2}, decoder: 4), input size 2560x1920, swin window size 10, IIT-CDIP (11M) and SynthDoG (English, Chinese, Japanese, Korean, 0.5M x 4).\n- [`donut-proto`](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-proto\u002Ftree\u002Fofficial): (preliminary model) trained with 8 V100 GPUs (~5 days), number of layers (encoder: {2,2,18,2}, decoder: 4), input size 2048x1536, swin window size 8, and SynthDoG (English, Japanese, Korean, 0.4M x 3).\n\nPlease see [our paper](#how-to-cite) for more details.\n\n## SynthDoG datasets\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_9b193c388dff.png)\n\nThe links to the SynthDoG-generated datasets are here:\n\n- [`synthdog-en`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-en): English, 0.5M.\n- [`synthdog-zh`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-zh): Chinese, 0.5M.\n- [`synthdog-ja`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-ja): Japanese, 0.5M.\n- [`synthdog-ko`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-ko): Korean, 0.5M.\n\nTo generate synthetic datasets with our SynthDoG, please see `.\u002Fsynthdog\u002FREADME.md` and [our paper](#how-to-cite) for details.\n\n## Updates\n\n**_2023-06-15_** We have updated all Google Colab demos to ensure its proper working.\u003Cbr>\n**_2022-11-14_** New version 1.0.9 is released (`pip install donut-python --upgrade`). See [1.0.9 Release Notes](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Freleases\u002Ftag\u002F1.0.9).\u003Cbr>\n**_2022-08-12_** Donut 🍩 is also available at [huggingface\u002Ftransformers 🤗](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Ftransformers\u002Fmain\u002Fen\u002Fmodel_doc\u002Fdonut) (contributed by [@NielsRogge](https:\u002F\u002Fgithub.com\u002FNielsRogge)). `donut-python` loads the pre-trained weights from the `official` branch of the model repositories. See [1.0.5 Release Notes](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Freleases\u002Ftag\u002F1.0.5).\u003Cbr>\n**_2022-08-05_** A well-executed hands-on tutorial on donut 🍩 is published at [Towards Data Science](https:\u002F\u002Ftowardsdatascience.com\u002Focr-free-document-understanding-with-donut-1acfbdf099be) (written by [@estaudere](https:\u002F\u002Fgithub.com\u002Festaudere)).\u003Cbr>\n**_2022-07-20_** First Commit, We release our code, model weights, synthetic data and generator.\n\n## Software installation\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdonut-python?color=green&label=pip%20install%20donut-python)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python)\n[![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_18a0a56d95e5.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdonut-python)\n\n```bash\npip install donut-python\n```\n\nor clone this repository and install the dependencies:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut.git\ncd donut\u002F\nconda create -n donut_official python=3.7\nconda activate donut_official\npip install .\n```\n\nWe tested [donut-python](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python\u002F1.0.1) == 1.0.1 with:\n- [torch](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fpytorch) == 1.11.0+cu113 \n- [torchvision](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fvision) == 0.12.0+cu113\n- [pytorch-lightning](https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Flightning) == 1.6.4\n- [transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers) == 4.11.3\n- [timm](https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models) == 0.5.4\n\n**Note**: From several reported issues, we have noticed increased challenges in configuring the testing environment for `donut-python` due to recent updates in key dependency libraries. While we are actively working on a solution, we have updated the Google Colab demo (as of June 15, 2023) to ensure its proper working. For assistance, we encourage you to refer to the following demo links: [CORD Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NMSqoIZ_l39wyRD7yVjw2FIuU2aglzJi?usp=sharing), [Train Ticket Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1YJBjllahdqNktXaBlq5ugPh1BCm8OsxI?usp=sharing), [RVL-CDIP Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1iWOZHvao1W5xva53upcri5V6oaWT-P0O?usp=sharing), [DocVQA Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1oKieslZCulFiquequ62eMGc-ZWgay4X3?usp=sharing).\n\n## Getting Started\n\n### Data\n\nThis repository assumes the following structure of dataset:\n```bash\n> tree dataset_name\ndataset_name\n├── test\n│   ├── metadata.jsonl\n│   ├── {image_path0}\n│   ├── {image_path1}\n│             .\n│             .\n├── train\n│   ├── metadata.jsonl\n│   ├── {image_path0}\n│   ├── {image_path1}\n│             .\n│             .\n└── validation\n    ├── metadata.jsonl\n    ├── {image_path0}\n    ├── {image_path1}\n              .\n              .\n\n> cat dataset_name\u002Ftest\u002Fmetadata.jsonl\n{\"file_name\": {image_path0}, \"ground_truth\": \"{\\\"gt_parse\\\": {ground_truth_parse}, ... {other_metadata_not_used} ... }\"}\n{\"file_name\": {image_path1}, \"ground_truth\": \"{\\\"gt_parse\\\": {ground_truth_parse}, ... {other_metadata_not_used} ... }\"}\n     .\n     .\n```\n\n- The structure of `metadata.jsonl` file is in [JSON Lines text format](https:\u002F\u002Fjsonlines.org), i.e., `.jsonl`. Each line consists of\n  - `file_name` : relative path to the image file.\n  - `ground_truth` : string format (json dumped), the dictionary contains either `gt_parse` or `gt_parses`. Other fields (metadata) can be added to the dictionary but will not be used.\n- `donut` interprets all tasks as a JSON prediction problem. As a result, all `donut` model training share a same pipeline. For training and inference, the only thing to do is preparing `gt_parse` or `gt_parses` for the task in format described below.\n\n#### For Document Classification\nThe `gt_parse` follows the format of `{\"class\" : {class_name}}`, for example, `{\"class\" : \"scientific_report\"}` or `{\"class\" : \"presentation\"}`.\n- Google colab demo is available [here](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1xUDmLqlthx8A8rWKLMSLThZ7oeRJkDuU?usp=sharing).\n- Gradio web demo is available [here](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-rvlcdip).\n\n#### For Document Information Extraction\nThe `gt_parse` is a JSON object that contains full information of the document image, for example, the JSON object for a receipt may look like `{\"menu\" : [{\"nm\": \"ICE BLACKCOFFEE\", \"cnt\": \"2\", ...}, ...], ...}`.\n- More examples are available at [CORD dataset](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fcord-v2).\n- Google colab demo is available [here](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1o07hty-3OQTvGnc_7lgQFLvvKQuLjqiw?usp=sharing).\n- Gradio web demo is available [here](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2).\n\n#### For Document Visual Question Answering\nThe `gt_parses` follows the format of `[{\"question\" : {question_sentence}, \"answer\" : {answer_candidate_1}}, {\"question\" : {question_sentence}, \"answer\" : {answer_candidate_2}}, ...]`, for example, `[{\"question\" : \"what is the model name?\", \"answer\" : \"donut\"}, {\"question\" : \"what is the model name?\", \"answer\" : \"document understanding transformer\"}]`.\n- DocVQA Task1 has multiple answers, hence `gt_parses` should be a list of dictionary that contains a pair of question and answer.\n- Google colab demo is available [here](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1Z4WG8Wunj3HE0CERjt608ALSgSzRC9ig?usp=sharing).\n- Gradio web demo is available [here](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-docvqa).\n\n#### For (Pseudo) Text Reading Task\nThe `gt_parse` looks like `{\"text_sequence\" : \"word1 word2 word3 ... \"}`\n- This task is also a pre-training task of Donut model.\n- You can use our **SynthDoG** 🐶 to generate synthetic images for the text reading task with proper `gt_parse`. See `.\u002Fsynthdog\u002FREADME.md` for details.\n\n### Training\n\nThis is the configuration of Donut model training on [CORD](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fcord) dataset used in our experiment. \nWe ran this with a single NVIDIA A100 GPU.\n\n```bash\npython train.py --config config\u002Ftrain_cord.yaml \\\n                --pretrained_model_name_or_path \"naver-clova-ix\u002Fdonut-base\" \\\n                --dataset_name_or_paths '[\"naver-clova-ix\u002Fcord-v2\"]' \\\n                --exp_version \"test_experiment\"    \n  .\n  .                                                                                                                                                                                                                                         \nPrediction: \u003Cs_menu>\u003Cs_nm>Lemon Tea (L)\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>25.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>25.000\u003C\u002Fs_total_price>\u003Cs_cashprice>30.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>5.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nAnswer: \u003Cs_menu>\u003Cs_nm>Lemon Tea (L)\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>25.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>25.000\u003C\u002Fs_total_price>\u003Cs_cashprice>30.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>5.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nNormed ED: 0.0\nPrediction: \u003Cs_menu>\u003Cs_nm>Hulk Topper Package\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>100.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>100.000\u003C\u002Fs_total_price>\u003Cs_cashprice>100.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>0\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nAnswer: \u003Cs_menu>\u003Cs_nm>Hulk Topper Package\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>100.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>100.000\u003C\u002Fs_total_price>\u003Cs_cashprice>100.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>0\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nNormed ED: 0.0\nPrediction: \u003Cs_menu>\u003Cs_nm>Giant Squid\u003C\u002Fs_nm>\u003Cs_cnt>x 1\u003C\u002Fs_cnt>\u003Cs_price>Rp. 39.000\u003C\u002Fs_price>\u003Cs_sub>\u003Cs_nm>C.Finishing - Cut\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>B.Spicy Level - Extreme Hot Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003Csep\u002F>\u003Cs_nm>A.Flavour - Salt & Pepper\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003C\u002Fs_menu>\u003Cs_sub_total>\u003Cs_subtotal_price>Rp. 39.000\u003C\u002Fs_subtotal_price>\u003C\u002Fs_sub_total>\u003Cs_total>\u003Cs_total_price>Rp. 39.000\u003C\u002Fs_total_price>\u003Cs_cashprice>Rp. 50.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>Rp. 11.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nAnswer: \u003Cs_menu>\u003Cs_nm>Giant Squid\u003C\u002Fs_nm>\u003Cs_cnt>x1\u003C\u002Fs_cnt>\u003Cs_price>Rp. 39.000\u003C\u002Fs_price>\u003Cs_sub>\u003Cs_nm>C.Finishing - Cut\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>B.Spicy Level - Extreme Hot\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>A.Flavour- Salt & Pepper\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003C\u002Fs_menu>\u003Cs_sub_total>\u003Cs_subtotal_price>Rp. 39.000\u003C\u002Fs_subtotal_price>\u003C\u002Fs_sub_total>\u003Cs_total>\u003Cs_total_price>Rp. 39.000\u003C\u002Fs_total_price>\u003Cs_cashprice>Rp. 50.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>Rp. 11.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\nNormed ED: 0.039603960396039604                                                                                                                                  \nEpoch 29: 100%|█████████████| 200\u002F200 [01:49\u003C00:00,  1.82it\u002Fs, loss=0.00327, exp_name=train_cord, exp_version=test_experiment]\n```\n\nSome important arguments:\n\n- `--config` : config file path for model training.\n- `--pretrained_model_name_or_path` : string format, model name in Hugging Face modelhub or local path.\n- `--dataset_name_or_paths` : string format (json dumped), list of dataset names in Hugging Face datasets or local paths.\n- `--result_path` : file path to save model outputs\u002Fartifacts.\n- `--exp_version` : used for experiment versioning. The output files are saved at `{result_path}\u002F{exp_version}\u002F*`\n\n### Test\n\nWith the trained model, test images and ground truth parses, you can get inference results and accuracy scores.\n\n```bash\npython test.py --dataset_name_or_path naver-clova-ix\u002Fcord-v2 --pretrained_model_name_or_path .\u002Fresult\u002Ftrain_cord\u002Ftest_experiment --save_path .\u002Fresult\u002Foutput.json\n100%|█████████████| 100\u002F100 [00:35\u003C00:00,  2.80it\u002Fs]\nTotal number of samples: 100, Tree Edit Distance (TED) based accuracy score: 0.9129639764131697, F1 accuracy score: 0.8406020841373987\n```\n\nSome important arguments:\n\n- `--dataset_name_or_path` : string format, the target dataset name in Hugging Face datasets or local path.\n- `--pretrained_model_name_or_path` : string format, the model name in Hugging Face modelhub or local path.\n- `--save_path`: file path to save predictions and scores.\n\n## How to Cite\nIf you find this work useful to you, please cite:\n```bibtex\n@inproceedings{kim2022donut,\n  title     = {OCR-Free Document Understanding Transformer},\n  author    = {Kim, Geewook and Hong, Teakgyu and Yim, Moonbin and Nam, JeongYeon and Park, Jinyoung and Yim, Jinyeong and Hwang, Wonseok and Yun, Sangdoo and Han, Dongyoon and Park, Seunghyun},\n  booktitle = {European Conference on Computer Vision (ECCV)},\n  year      = {2022}\n}\n```\n\n## License\n\n```\nMIT license\n\nCopyright (c) 2022-present NAVER Corp.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and\u002For sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","\u003Cdiv align=\"center\">\n    \n# Donut 🍩：文档理解 Transformer\n\n[![论文](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPaper-arxiv.2111.15664-red)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664)\n[![会议](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FECCV-2022-blue)](#如何引用)\n[![演示](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Gradio-brightgreen)](#demo)\n[![演示](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Colab-orange)](#demo)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdonut-python?color=green&label=pip%20install%20donut-python)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python)\n[![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_18a0a56d95e5.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdonut-python)\n\nDonut 和 SynthDoG 的官方实现 | [论文](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664) | [幻灯片](https:\u002F\u002Fdocs.google.com\u002Fpresentation\u002Fd\u002F1gv3A7t4xpwwNdpxV_yeHzEOMy-exJCAz6AlAI9O5fS8\u002Fedit?usp=sharing) | [海报](https:\u002F\u002Fdocs.google.com\u002Fpresentation\u002Fd\u002F1m1f8BbAm5vxPcqynn_MbFfmQAlHQIR5G72-hQUFS2sk\u002Fedit?usp=sharing)\n\n\u003C\u002Fdiv>\n\n## 简介\n\n**Donut** 🍩，即 **Do**cume**n**t **u**nderstanding **t**ransformer，是一种全新的文档理解方法，它采用无 OCR 的端到端 Transformer 模型。Donut 无需现成的 OCR 引擎或 API，却在多种视觉文档理解任务上表现出最先进的性能，例如视觉文档分类或信息提取（即文档解析）。此外，我们还提出了 **SynthDoG** 🐶，即 **Synth**etic **Do**cument **G**enerator，它可以帮助模型在多种语言和领域上进行灵活的预训练。\n\n我们的学术论文详细描述了该方法，并提供了完整的实验结果与分析，可在此处找到：\u003Cbr>\n> [**无 OCR 文档理解 Transformer**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.15664)。\u003Cbr>\n> Geewook Kim (https:\u002F\u002Fgeewook.kim), Teakgyu Hong (https:\u002F\u002Fdblp.org\u002Fpid\u002F183\u002F0952.html), Moonbin Yim (https:\u002F\u002Fgithub.com\u002Fmoonbings), JeongYeon Nam (https:\u002F\u002Fgithub.com\u002Flong8v), Jinyoung Park (https:\u002F\u002Fgithub.com\u002Fjyp1111), Jinyeong Yim (https:\u002F\u002Fjinyeong.github.io), Wonseok Hwang (https:\u002F\u002Fscholar.google.com\u002Fcitations?user=M13_WdcAAAAJ), Sangdoo Yun (https:\u002F\u002Fsangdooyun.github.io), Dongyoon Han (https:\u002F\u002Fdongyoonhan.github.io), Seunghyun Park (https:\u002F\u002Fscholar.google.com\u002Fcitations?user=iowjmTwAAAAJ)。发表于 ECCV 2022。\n\n\u003Cimg width=\"946\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_9c9980a62787.png\">\n\n## 预训练模型与网页演示\n\nGradio 网页演示现已上线！[![演示](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Gradio-brightgreen)](#demo) [![演示](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Colab-orange)](#demo)\n|:--:|\n|![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_5c12f735c6fb.png)|\n- 您可以使用 `.\u002Fapp.py` 文件运行演示。\n- 示例图片可在 `.\u002Fmisc` 中找到，更多收据图片则可在 [CORD 数据集链接](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fcord-v2) 获取。\n- 网页演示可通过下表中的链接访问。\n- 注意：我们已于 2023 年 6 月 15 日更新了 Google Colab 演示，以确保其正常运行。\n\n|任务|每张图片耗时|分数|训练模型|\u003Cdiv id=\"demo\">演示\u003C\u002Fdiv>|\n|---|---|---|---|---|\n| [CORD](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fcord)（文档解析）   |   0.7 \u002F\u003Cbr> 0.7 \u002F\u003Cbr> 1.2   |  91.3 \u002F\u003Cbr> 91.1 \u002F\u003Cbr> 90.9    | [donut-base-finetuned-cord-v2](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2\u002Ftree\u002Fofficial) (1280) \u002F\u003Cbr> [donut-base-finetuned-cord-v1](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1\u002Ftree\u002Fofficial) (1280) \u002F\u003Cbr> [donut-base-finetuned-cord-v1-2560](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1-2560\u002Ftree\u002Fofficial) | [gradio space 网页演示](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2),\u003Cbr>[google colab 演示（23.06.15 更新）](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NMSqoIZ_l39wyRD7yVjw2FIuU2aglzJi?usp=sharing) |\n| [火车票](https:\u002F\u002Fgithub.com\u002Fbeacandler\u002FEATEN)（文档解析）   |   0.6   |  98.7    | [donut-base-finetuned-zhtrainticket](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-zhtrainticket\u002Ftree\u002Fofficial) | [google colab 演示（23.06.15 更新）](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1YJBjllahdqNktXaBlq5ugPh1BCm8OsxI?usp=sharing) |\n| [RVL-CDIP](https:\u002F\u002Fwww.cs.cmu.edu\u002F~aharley\u002Frvl-cdip)（文档分类）     |  0.75   |   95.3      | [donut-base-finetuned-rvlcdip](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-rvlcdip\u002Ftree\u002Fofficial) | [gradio space 网页演示](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-rvlcdip),\u003Cbr>[google colab 演示（23.06.15 更新）](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1iWOZHvao1W5xva53upcri5V6oaWT-P0O?usp=sharing) |\n| [DocVQA Task1](https:\u002F\u002Frrc.cvc.uab.es\u002F?ch=17)（文档 VQA） |  0.78       | 67.5 | [donut-base-finetuned-docvqa](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-docvqa\u002Ftree\u002Fofficial) | [gradio space 网页演示](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-docvqa),\u003Cbr>[google colab 演示（23.06.15 更新）](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1oKieslZCulFiquequ62eMGc-ZWgay4X3?usp=sharing) |\n\n预训练骨干模型的链接如下：\n- [`donut-base`](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base\u002Ftree\u002Fofficial)：由 64 块 A100 GPU 训练而成（约 2.5 天），层数为（编码器：{2,2,14,2}, 解码器：4），输入尺寸为 2560×1920，Swin 窗口大小为 10，数据来源为 IIT-CDIP（1100 万张）和 SynthDoG（英语、中文、日语、韩语，每种 50 万张）。\n- [`donut-proto`](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-proto\u002Ftree\u002Fofficial)：（初步模型）由 8 块 V100 GPU 训练而成（约 5 天），层数为（编码器：{2,2,18,2}, 解码器：4），输入尺寸为 2048×1536，Swin 窗口大小为 8，数据来源为 SynthDoG（英语、日语、韩语，每种 40 万张）。\n\n更多详情请参阅我们的论文（见“如何引用”部分）。\n\n## SynthDoG 数据集\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_9b193c388dff.png)\n\nSynthDoG 生成的数据集链接如下：\n\n- [`synthdog-en`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-en)：英语，50 万张。\n- [`synthdog-zh`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-zh)：中文，50 万张。\n- [`synthdog-ja`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-ja)：日语，50 万张。\n- [`synthdog-ko`](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fsynthdog-ko)：韩语，50 万张。\n\n如需使用我们的 SynthDoG 生成合成数据集，请参阅 `.\u002Fsynthdog\u002FREADME.md` 及我们的论文（见“如何引用”部分）获取详细信息。\n\n## 更新\n\n**_2023-06-15_** 我们已更新所有 Google Colab 演示，以确保其正常运行。\u003Cbr>\n**_2022-11-14_** 新版本 1.0.9 已发布（`pip install donut-python --upgrade`）。请参阅 [1.0.9 发行说明](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Freleases\u002Ftag\u002F1.0.9)。\u003Cbr>\n**_2022-08-12_** Donut 🍩 也已在 [huggingface\u002Ftransformers 🤗](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Ftransformers\u002Fmain\u002Fen\u002Fmodel_doc\u002Fdonut) 上提供（由 [@NielsRogge](https:\u002F\u002Fgithub.com\u002FNielsRogge) 贡献）。`donut-python` 会从模型仓库的 `official` 分支加载预训练权重。请参阅 [1.0.5 发行说明](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Freleases\u002Ftag\u002F1.0.5)。\u003Cbr>\n**_2022-08-05_** 关于 donut 🍩 的一篇操作性很强的教程已在 [Towards Data Science](https:\u002F\u002Ftowardsdatascience.com\u002Focr-free-document-understanding-with-donut-1acfbdf099be) 上发表（作者为 [@estaudere](https:\u002F\u002Fgithub.com\u002Festaudere)）。\u003Cbr>\n**_2022-07-20_** 首次提交，我们发布了代码、模型权重、合成数据及生成器。\n\n## 软件安装\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdonut-python?color=green&label=pip%20install%20donut-python)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python)\n[![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_readme_18a0a56d95e5.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdonut-python)\n\n```bash\npip install donut-python\n```\n\n或者克隆此仓库并安装依赖项：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut.git\ncd donut\u002F\nconda create -n donut_official python=3.7\nconda activate donut_official\npip install .\n```\n\n我们使用以下版本测试了 [donut-python](https:\u002F\u002Fpypi.org\u002Fproject\u002Fdonut-python\u002F1.0.1) == 1.0.1：\n- [torch](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fpytorch) == 1.11.0+cu113 \n- [torchvision](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fvision) == 0.12.0+cu113\n- [pytorch-lightning](https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Flightning) == 1.6.4\n- [transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers) == 4.11.3\n- [timm](https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models) == 0.5.4\n\n**注意**：根据多起反馈的问题，我们注意到由于关键依赖库的近期更新，配置 `donut-python` 的测试环境变得愈发困难。虽然我们正在积极寻找解决方案，但我们已于 2023 年 6 月 15 日更新了 Google Colab 演示，以确保其正常运行。如需帮助，请参考以下演示链接：[CORD Colab 演示](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NMSqoIZ_l39wyRD7yVjw2FIuU2aglzJi?usp=sharing)、[火车票 Colab 演示](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1YJBjllahdqNktXaBlq5ugPh1BCm8OsxI?usp=sharing)、[RVL-CDIP Colab 演示](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1iWOZHvao1W5xva53upcri5V6oaWT-P0O?usp=sharing)、[DocVQA Colab 演示](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1oKieslZCulFiquequ62eMGc-ZWgay4X3?usp=sharing)。\n\n## 入门指南\n\n### 数据\n\n本仓库假定数据集具有如下结构：\n```bash\n> tree dataset_name\ndataset_name\n├── test\n│   ├── metadata.jsonl\n│   ├── {image_path0}\n│   ├── {image_path1}\n│             .\n│             .\n├── train\n│   ├── metadata.jsonl\n│   ├── {image_path0}\n│   ├── {image_path1}\n│             .\n│             .\n└── validation\n    ├── metadata.jsonl\n    ├── {image_path0}\n    ├── {image_path1}\n              .\n              .\n\n> cat dataset_name\u002Ftest\u002Fmetadata.jsonl\n{\"file_name\": {image_path0}, \"ground_truth\": \"{\\\"gt_parse\\\": {ground_truth_parse}, ... {other_metadata_not_used} ... }\"}\n{\"file_name\": {image_path1}, \"ground_truth\": \"{\\\"gt_parse\\\": {ground_truth_parse}, ... {other_metadata_not_used} ... }\"}\n     .\n     .\n```\n\n- `metadata.jsonl` 文件的结构采用 [JSON Lines 文本格式](https:\u002F\u002Fjsonlines.org)，即 `.jsonl`。每行包含：\n  - `file_name`：图像文件的相对路径。\n  - `ground_truth`：字符串格式（JSON 序列化），字典中包含 `gt_parse` 或 `gt_parses`。其他字段（元数据）可以添加到字典中，但不会被使用。\n- `donut` 将所有任务视为 JSON 预测问题。因此，所有 `donut` 模型的训练都遵循相同的流程。在训练和推理时，唯一需要做的就是按照下文所述的格式准备任务所需的 `gt_parse` 或 `gt_parses`。\n\n#### 对于文档分类\n`gt_parse` 的格式为 `{\"class\" : {class_name}}`，例如 `{\"class\" : \"scientific_report\"}` 或 `{\"class\" : \"presentation\"}`。\n- Google Colab 演示可在 [这里](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1xUDmLqlthx8A8rWKLMSLThZ7oeRJkDuU?usp=sharing) 查看。\n- Gradio 网页演示可在 [这里](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-rvlcdip) 查看。\n\n#### 对于文档信息抽取\n`gt_parse` 是一个包含文档图像全部信息的 JSON 对象，例如，一张收据的 JSON 对象可能看起来是 `{\"menu\" : [{\"nm\": \"ICE BLACKCOFFEE\", \"cnt\": \"2\", ...}, ...], ...}`。\n- 更多示例可在 [CORD 数据集](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fnaver-clova-ix\u002Fcord-v2) 中找到。\n- Google Colab 演示可在 [这里](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1o07hty-3OQTvGnc_7lgQFLvvKQuLjqiw?usp=sharing) 查看。\n- Gradio 网页演示可在 [这里](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2) 查看。\n\n#### 对于文档视觉问答\n`gt_parses` 的格式为 `[{\"question\" : {question_sentence}, \"answer\" : {answer_candidate_1}}, {\"question\" : {question_sentence}, \"answer\" : {answer_candidate_2}}, ...]`，例如 `[{\"question\" : \"模型名称是什么？\", \"answer\" : \"donut\"}, {\"question\" : \"模型名称是什么？\", \"answer\" : \"文档理解 Transformer\"}]`。\n- DocVQA Task1 有多重答案，因此 `gt_parses` 应该是一个包含问题与答案对的字典列表。\n- Google Colab 演示可在 [这里](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1Z4WG8Wunj3HE0CERjt608ALSgSzRC9ig?usp=sharing) 查看。\n- Gradio 网页演示可在 [这里](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnielsr\u002Fdonut-docvqa) 查看。\n\n#### 对于（伪）文本阅读任务\n`gt_parse` 的格式为 `{\"text_sequence\" : \"word1 word2 word3 ... \"}`\n- 该任务同时也是 Donut 模型的预训练任务。\n- 您可以使用我们的 **SynthDoG** 🐶 生成适合文本阅读任务的合成图像，并附带正确的 `gt_parse`。详情请参阅 `.\u002Fsynthdog\u002FREADME.md`。\n\n### 训练\n\n这是我们实验中使用的、在 [CORD](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fcord) 数据集上训练 Donut 模型的配置。我们使用单块 NVIDIA A100 GPU 运行了该训练。\n\n```bash\npython train.py --config config\u002Ftrain_cord.yaml \\\n                --pretrained_model_name_or_path \"naver-clova-ix\u002Fdonut-base\" \\\n                --dataset_name_or_paths '[\"naver-clova-ix\u002Fcord-v2\"]' \\\n                --exp_version \"test_experiment\"    \n  .\n  .                                                                                                                                                                                                                                         \n预测: \u003Cs_menu>\u003Cs_nm>柠檬茶 (L)\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>25.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>25.000\u003C\u002Fs_total_price>\u003Cs_cashprice>30.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>5.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n答案: \u003Cs_menu>\u003Cs_nm>柠檬茶 (L)\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>25.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>25.000\u003C\u002Fs_total_price>\u003Cs_cashprice>30.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>5.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n归一化编辑距离: 0.0\n预测: \u003Cs_menu>\u003Cs_nm>浩克顶配套餐\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>100.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>100.000\u003C\u002Fs_total_price>\u003Cs_cashprice>100.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>0\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n答案: \u003Cs_menu>\u003Cs_nm>浩克顶配套餐\u003C\u002Fs_nm>\u003Cs_cnt>1\u003C\u002Fs_cnt>\u003Cs_price>100.000\u003C\u002Fs_price>\u003C\u002Fs_menu>\u003Cs_total>\u003Cs_total_price>100.000\u003C\u002Fs_total_price>\u003Cs_cashprice>100.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>0\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n归一化编辑距离: 0.0\n预测: \u003Cs_menu>\u003Cs_nm>巨型乌贼\u003C\u002Fs_nm>\u003Cs_cnt>x 1\u003C\u002Fs_cnt>\u003Cs_price>Rp. 39.000\u003C\u002Fs_price>\u003Cs_sub>\u003Cs_nm>C.精加工 - 切割\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>B.辣度 - 极辣 Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003Csep\u002F>\u003Cs_nm>A.口味 - 盐椒\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003C\u002Fs_menu>\u003Cs_sub_total>\u003Cs_subtotal_price>Rp. 39.000\u003C\u002Fs_subtotal_price>\u003C\u002Fs_sub_total>\u003Cs_total>\u003Cs_total_price>Rp. 39.000\u003C\u002Fs_total_price>\u003Cs_cashprice>Rp. 50.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>Rp. 11.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n答案: \u003Cs_menu>\u003Cs_nm>巨型乌贼\u003C\u002Fs_nm>\u003Cs_cnt>x1\u003C\u002Fs_cnt>\u003Cs_price>Rp. 39.000\u003C\u002Fs_price>\u003Cs_sub>\u003Cs_nm>C.精加工 - 切割\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>B.辣度 - 极辣\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003Csep\u002F>\u003Cs_nm>A.口味 - 盐椒\u003C\u002Fs_nm>\u003Cs_price>Rp. 0\u003C\u002Fs_price>\u003C\u002Fs_sub>\u003C\u002Fs_menu>\u003Cs_sub_total>\u003Cs_subtotal_price>Rp. 39.000\u003C\u002Fs_subtotal_price>\u003C\u002Fs_sub_total>\u003Cs_total>\u003Cs_total_price>Rp. 39.000\u003C\u002Fs_total_price>\u003Cs_cashprice>Rp. 50.000\u003C\u002Fs_cashprice>\u003Cs_changeprice>Rp. 11.000\u003C\u002Fs_changeprice>\u003C\u002Fs_total>\n归一化编辑距离: 0.039603960396039604                                                                                                                                  \n第29轮: 100%|█████████████| 200\u002F200 [01:49\u003C00:00,  1.82项\u002Fs, 损失=0.00327, 实验名称=train_cord, 实验版本=test_experiment]\n```\n\n一些重要参数：\n\n- `--config`：模型训练的配置文件路径。\n- `--pretrained_model_name_or_path`：字符串格式，可以是 Hugging Face Model Hub 中的模型名称或本地路径。\n- `--dataset_name_or_paths`：字符串格式（JSON 格式），包含 Hugging Face 数据集中的数据集名称列表或本地路径。\n- `--result_path`：用于保存模型输出和中间产物的文件路径。\n- `--exp_version`：用于实验版本管理。输出文件将保存在 `{result_path}\u002F{exp_version}\u002F*` 目录下。\n\n### 测试\n\n使用训练好的模型、测试图像以及真实标注，可以获取推理结果和准确率分数。\n\n```bash\npython test.py --dataset_name_or_path naver-clova-ix\u002Fcord-v2 --pretrained_model_name_or_path .\u002Fresult\u002Ftrain_cord\u002Ftest_experiment --save_path .\u002Fresult\u002Foutput.json\n100%|█████████████| 100\u002F100 [00:35\u003C00:00,  2.80项\u002Fs]\n样本总数: 100，基于树编辑距离（TED）的准确率：0.9129639764131697，F1 准确率：0.8406020841373987\n```\n\n一些重要参数：\n\n- `--dataset_name_or_path`：字符串格式，目标数据集的名称或本地路径。\n- `--pretrained_model_name_or_path`：字符串格式，Hugging Face Model Hub 中的模型名称或本地路径。\n- `--save_path`：用于保存预测结果和评分的文件路径。\n\n## 引用方式\n如果您觉得这项工作对您有帮助，请引用以下内容：\n```bibtex\n@inproceedings{kim2022donut,\n  title     = {无OCR文档理解Transformer},\n  author    = {Kim, Geewook 和 Hong, Teakgyu 和 Yim, Moonbin 和 Nam, JeongYeon 和 Park, Jinyoung 和 Yim, Jinyeong 和 Hwang, Wonseok 和 Yun, Sangdoo 和 Han, Dongyoon 和 Park, Seunghyun},\n  booktitle = {欧洲计算机视觉大会 (ECCV)},\n  year      = {2022}\n}\n```\n\n## 许可证\n\n```\nMIT 许可证\n\n版权所有 © 2022-present NAVER Corp.\n\n特此授予任何人免费获得本软件及其相关文档文件（“软件”）副本的权利，以进行处理。在不受限制的情况下，包括但不限于使用、复制、修改、合并、发布、分发、再许可和\u002F或销售软件副本的权利，以及允许向任何接收软件的人提供软件的权利，但须遵守以下条件：\n\n上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。\n\n“软件”按“原样”提供，不提供任何形式的保证，无论是明示的还是默示的，包括但不限于适销性、特定用途适用性和非侵权性的保证。在任何情况下，作者或版权所有者均不对任何索赔、损害或其他责任负责，无论这些责任是基于合同、侵权行为或其他原因产生的，与软件或其使用有关的一切责任均由作者或版权所有者承担。\n```","# Donut 🍩 快速上手指南\n\nDonut (Document Understanding Transformer) 是一个无需 OCR 引擎的端到端文档理解模型。它可以直接从文档图像中提取结构化信息（如收据解析、文档分类、视觉问答等），支持多种语言，且在多项任务中达到了业界领先（SOTA）水平。\n\n## 1. 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux (推荐) 或 macOS\n*   **Python 版本**: 3.7 及以上 (官方测试基于 3.7)\n*   **GPU**: 推荐使用 NVIDIA GPU 以加速推理和训练（需安装对应的 CUDA 驱动）\n*   **前置依赖**:\n    *   PyTorch >= 1.11.0\n    *   torchvision >= 0.12.0\n    *   pytorch-lightning >= 1.6.4\n    *   transformers >= 4.11.3\n    *   timm >= 0.5.4\n\n> **注意**：由于依赖库更新频繁，本地环境配置可能会遇到兼容性问题。如果本地安装困难，建议优先使用官方提供的 [Google Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NMSqoIZ_l39wyRD7yVjw2FIuU2aglzJi?usp=sharing) 进行体验。\n\n## 2. 安装步骤\n\n您可以通过 PyPI 直接安装，或者克隆源码进行安装。\n\n### 方法一：通过 pip 安装（推荐）\n\n```bash\npip install donut-python\n```\n\n### 方法二：源码安装\n\n如果您需要修改代码或使用最新特性，可以克隆仓库安装：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut.git\ncd donut\u002F\n\n# 创建并激活 conda 环境\nconda create -n donut_official python=3.7\nconda activate donut_official\n\n# 安装依赖\npip install .\n```\n\n## 3. 基本使用\n\nDonut 将所有的文档理解任务（分类、信息提取、VQA）统一视为 **JSON 预测问题**。您只需加载预训练模型，输入图像，即可得到结构化的 JSON 输出。\n\n以下是一个最简单的 Python 使用示例，演示如何加载模型并对图像进行推理：\n\n```python\nimport torch\nfrom PIL import Image\nfrom donut import DonutProcessor, DonutModel\n\n# 1. 加载处理器和模型\n# 这里以 CORD (收据解析) 微调模型为例，其他任务可替换为对应的 model name\nmodel_name = \"naver-clova-ix\u002Fdonut-base-finetuned-cord-v2\"\nprocessor = DonutProcessor.from_pretrained(model_name)\nmodel = DonutModel.from_pretrained(model_name)\n\n# 将模型移动到 GPU (如果可用)\ndevice = \"cuda\" if torch.cuda.is_available() else \"cpu\"\nmodel.to(device)\n\n# 2. 准备图像\n# 替换为您的图片路径\nimage_path = \"receipt_example.png\" \nimage = Image.open(image_path).convert(\"RGB\")\n\n# 3. 预处理\n# prompt 通常为空字符串，因为模型是端到端的，不需要额外的文本提示\ntask_prompt = \"\"\ndecoder_input_ids = processor.tokenizer(\n    task_prompt, add_special_tokens=False, return_tensors=\"pt\"\n).input_ids\n\npixel_values = processor(image, return_tensors=\"pt\").pixel_values\n\n# 4. 生成预测\noutputs = model.generate(\n    pixel_values=pixel_values.to(device),\n    decoder_input_ids=decoder_input_ids.to(device),\n    max_length=model.decoder.config.max_position_embeddings,\n    early_stopping=True,\n    pad_token_id=processor.tokenizer.pad_token_id,\n    eos_token_id=processor.tokenizer.eos_token_id,\n    use_cache=True,\n    num_beams=1,\n    bad_words_ids=[[processor.tokenizer.unk_token_id]],\n)\n\n# 5. 解析结果\nsequence = processor.batch_decode(outputs)[0]\n# 移除可能存在的特殊标记并转换为 JSON\nsequence = sequence.replace(processor.tokenizer.eos_token, \"\").replace(\n    processor.tokenizer.pad_token, \"\"\n)\nsequence = sequence.split(\"\u003Cs_json_object>\")[1].split(\"\u003Ce_json_object>\")[0]\n\nimport json\nresult = json.loads(sequence)\n\nprint(\"提取结果:\", result)\n```\n\n### 任务说明\n*   **文档分类 (Document Classification)**: 输出格式为 `{\"class\": \"类别名称\"}`。\n*   **信息提取 (Information Extraction)**: 输出为包含文档所有关键字段的完整 JSON 对象（例如收据中的菜品名、价格等）。\n*   **视觉问答 (Visual Question Answering)**: 输出为包含问题和答案候选项的列表。\n\n您可以从 [Hugging Face Models](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix) 找到针对不同任务（如火车票识别、RVL-CDIP 分类、DocVQA 等）的预训练模型权重，只需更改上述代码中的 `model_name` 即可切换任务。","某跨国电商的财务团队每天需处理来自全球不同国家的数万张手写或打印格式各异的报销收据，以提取金额、日期和商户信息进行自动入账。\n\n### 没有 donut 时\n- **依赖传统 OCR 引擎**：必须串联调用第三方 OCR 服务识别文字，再使用正则表达式提取字段，链路长且维护成本高。\n- **多语言支持困难**：面对日语、韩语或小语种收据，通用 OCR 识别率大幅下降，导致后续提取频繁出错。\n- **版面适应性差**：一旦收据模板发生微小变化（如字段位置移动），原本写死的规则立即失效，需人工重新调整代码。\n- **手写体识别瓶颈**：对于店员手写的金额或备注，传统 OCR 几乎无法准确识别，大量单据被迫转入人工复核流程。\n\n### 使用 donut 后\n- **端到端直接解析**：donut 摒弃了独立的 OCR 步骤，直接将收据图像输入模型，一次性输出结构化的 JSON 数据，大幅简化架构。\n- **原生多语言能力**：得益于 SynthDoG 生成的合成数据预训练，donut 能无缝理解并提取多种语言收据中的关键信息，无需额外配置。\n- **鲁棒的泛化性能**：基于 Transformer 架构，donut 对文档布局变化具有极强的适应力，即使面对从未见过的收据版式也能准确定位字段。\n- **精准处理手写内容**：在视觉文档理解任务上表现卓越，donut 能高精度识别手写数字和非标准打印字体，显著降低人工干预比例。\n\ndonut 通过“无 OCR\"的端到端转型，将复杂的多国别票据处理流程从繁琐的规则维护中解放出来，实现了真正的智能化与自动化。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fclovaai_donut_5c12f735.png","clovaai","Clova AI Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fclovaai_47694549.jpg","Open source repository of Clova AI Research, NAVER & LINE",null,"clova-ai-research@navercorp.com","https:\u002F\u002Fclova.ai\u002Fen\u002Fresearch\u002Fresearch-areas.html","https:\u002F\u002Fgithub.com\u002Fclovaai",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,6840,560,"2026-04-19T14:55:54","MIT","未说明","训练需多卡环境（官方使用 64 张 A100 或 8 张 V100）；推理未强制要求但建议使用支持 CUDA 的 NVIDIA GPU。官方测试环境为 CUDA 11.3 (cu113)。",{"notes":92,"python":93,"dependencies":94},"官方指出由于关键依赖库更新，配置本地测试环境面临挑战，建议优先使用已更新的 Google Colab 演示进行体验。模型输入分辨率较高（如 2560x1920），对显存有一定要求。可通过 pip 安装 donut-python 或使用 conda 创建名为 donut_official 的环境进行源码安装。","3.7",[95,96,97,98,99],"torch==1.11.0+cu113","torchvision==0.12.0+cu113","pytorch-lightning==1.6.4","transformers==4.11.3","timm==0.5.4",[101,36,15],"其他",[103,104,105,106,107,108],"document-ai","eccv-2022","multimodal-pre-trained-model","ocr","nlp","computer-vision","2026-03-27T02:49:30.150509","2026-04-20T22:36:54.856624",[112,117,122,127,132,136],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},45904,"如何为新语言（如罗马尼亚语）创建预训练模型？","您可以基于现有的 'naver-clova-ix\u002Fdonut-base' 模型进行新语言的预训练。关键步骤包括准备格式正确的 metadata.jsonl 数据集，并修改配置文件。以下是一个成功的配置示例：\n1. 设置 pretrained_model_name_or_path 为 \"naver-clova-ix\u002Fdonut-base\"。\n2. 指定 dataset_name_or_paths 指向您的新语言数据集路径。\n3. 调整输入分辨率 (input_size)，如果与预训练设置不同，部分权重会被重新初始化，但通常不影响训练。\n4. 设置合适的学习率 (lr, 例如 3e-5) 和预热步数 (warmup_steps)。\n注意：可能需要替换 tokenizer 以支持新语言的字符集。","https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fissues\u002F143",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},45905,"为什么推理结果与测试脚本 (test.py) 的结果不一致，缺失了某些字段？","这通常是由于图像分辨率不匹配导致的。建议采取以下策略：\n1. 先在高分辨率（如 2560x1920）的数据集上进行预训练或微调（例如 20 个 epoch）。\n2. 使用生成的检查点，在较低分辨率的图像上进行进一步微调。\n这种方法虽然可能无法完全解决问题，但能显著提高准确率（例如达到 96% 以上）。此外，确保推理时的图像预处理流程与训练时完全一致。","https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fissues\u002F43",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},45906,"加载预训练模型时出现 \"Make sure _init_weights is implemented\" 错误或 TypeError，如何解决？","这类错误通常是因为推理脚本和训练脚本使用的 `transformers` 库版本不一致导致的。\n解决方案：\n1. 检查并统一环境中的 `transformers` 库版本，确保训练和推理使用相同的版本。\n2. 如果问题依旧，尝试完全重新实现加载逻辑或克隆官方分支的最新代码，确保 `_init_weights` 方法被正确继承和实现。\n3. 对于 TypeError: '\u003C' not supported between instances of 'NoneType' and 'int'，请检查 config 文件中 `max_steps` 等参数是否被正确设置为整数，而非 None。","https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fissues\u002F29",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},45907,"如何在 FUNSD 数据集上微调 Donut 模型？有具体的命令和配置吗？","可以使用 HuggingFace 上的数据集直接进行微调。以下是具体的操作步骤和命令：\n1. 安装依赖：`pip install pytorch-lightning==1.6.4 transformers==4.11.3 timm==0.5.4 sconf zss datasets[vision] sentencepiece`\n2. 运行训练命令：\n`python train.py --config config\u002Ftrain_funsd.yaml --pretrained_model_name_or_path \"naver-clova-ix\u002Fdonut-base\" --dataset_name_or_paths '[\"SotiriosKastanas\u002Fdifffunsd\"]' --exp_version \"Experiment_120_train_29valid_200epochs\"`\n3. 运行测试命令：\n`python test.py --dataset_name_or_path SotiriosKastanas\u002Fdifffunsd --pretrained_model_name_or_path .\u002Fresult\u002Ftrain_funsd\u002FExperiment_120_train_29valid_200epochs --save_path .\u002Fresult\u002Foutput200_120_29.json`\n需确保 `train_funsd.yaml` 配置文件中正确设置了上述参数。","https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fissues\u002F8",{"id":133,"question_zh":134,"answer_zh":135,"source_url":121},45908,"针对小尺寸或裁剪后的图像（如发票号码区域），Donut 模型效果不佳怎么办？","当处理小尺寸图像（例如 428x24 像素）或经过对象检测（如 YOLOv8）裁剪后的特定区域图像时，直接训练效果可能不理想。\n建议方案：\n1. 不要直接在裁剪后的小图上从头训练。\n2. 先在包含完整文档的大尺寸图像（如 2560x1920）上进行预训练或微调，让模型学习整体布局特征。\n3. 然后使用大模型得到的检查点，针对裁剪后的小图数据进行微调（Fine-tuning）。\n这种“先大后小”的迁移学习策略能有效提升对小目标文本的提取准确率。",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},45909,"在越南语等非主流语言上进行页面解析微调时，编辑距离 (ED) 很高且结果很差，该如何优化？","如果在非主流语言（如越南语）上微调效果差（高 ED），即使使用了合成数据也无效，可以尝试以下调整：\n1. 增加预训练阶段：不要直接微调，先使用大量该语言的扫描文档进行预训练（Pretraining），构建专属的基础模型。\n2. 调整图像输入尺寸：尝试不同的 input_size 配置，确保图像清晰度足够。\n3. 延长训练时间：30 个 epoch 可能不足，尝试增加 epoch 数量，并监控验证集损失。\n4. 检查 Tokenizer：确认是否为新语言替换或扩展了 tokenizer，以覆盖特定的字符集。","https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fissues\u002F161",[142,147,152,157,162,167],{"id":143,"version":144,"summary_zh":145,"released_at":146},360847,"1.0.9","- 通过移除与 torch.bfloat16 相关的代码行来提升 CPU 性能 1f4b27c\n- 更新注释和 README","2022-11-14T09:21:39",{"id":148,"version":149,"summary_zh":150,"released_at":151},360848,"1.0.8","- 支持 `transformer` 的新版本 https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fdonut\u002Fpull\u002F56\n- 更新 `JSONParseEvaluator` e33da0e\n  - 增强 `normalize_dict` 和 `update_cost` 中的逻辑\n- 更新注释和 README","2022-10-05T08:48:42",{"id":153,"version":154,"summary_zh":155,"released_at":156},360849,"1.0.7","- 更新 `JSONParseEvaluator` 86bcafe\n  - 添加计算（严格）F1准确率分数的函数\n  - 改进 `normalize_dict` 中的逻辑\n- 更新文档字符串和注释","2022-08-23T10:51:54",{"id":158,"version":159,"summary_zh":160,"released_at":161},360850,"1.0.5","- `donut-python` 从模型仓库的 `official` 分支加载预训练权重 f174bb0\n  - [donut-base](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base\u002Ftree\u002Fofficial)\n  - [donut-proto](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-proto\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-cord-v2](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v2\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-cord-v1](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-cord-v1-2560](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-cord-v1-2560\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-zhtrainticket](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-zhtrainticket\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-rvlcdip](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-rvlcdip\u002Ftree\u002Fofficial)\n  - [donut-base-finetuned-docvqa](https:\u002F\u002Fhuggingface.co\u002Fnaver-clova-ix\u002Fdonut-base-finetuned-docvqa\u002Ftree\u002Fofficial)","2022-08-04T15:06:12",{"id":163,"version":164,"summary_zh":165,"released_at":166},360851,"1.0.4","- 修复了一些 minor 问题\n  - 在 `prepare_input` 中将 PIL 图像转换为 RGB 格式 74507ce\n  - 将 `max_iter` 设置为 `config.max_steps` 4130973\n","2022-07-29T15:18:03",{"id":168,"version":169,"summary_zh":170,"released_at":171},360852,"1.0.3","- 初始发布","2022-07-20T14:49:21"]