[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-thunlp--OpenPrompt":3,"tool-thunlp--OpenPrompt":61},[4,18,26,36,44,52],{"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":10,"last_commit_at":24,"category_tags":25,"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":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"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 真正成长为懂上",141543,2,"2026-04-06T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":10,"last_commit_at":58,"category_tags":59,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,60],"视频",{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":78,"owner_twitter":77,"owner_website":79,"owner_url":80,"languages":81,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":32,"env_os":94,"env_gpu":94,"env_ram":94,"env_deps":95,"category_tags":101,"github_topics":102,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":119,"updated_at":120,"faqs":121,"releases":151},4528,"thunlp\u002FOpenPrompt","OpenPrompt","An Open-Source Framework for Prompt-Learning.","OpenPrompt 是一个专为“提示学习”（Prompt-learning）打造的开源框架，旨在帮助开发者更灵活、高效地将预训练语言模型适配到各类下游自然语言处理任务中。传统微调方法往往需要大量标注数据和计算资源，而 OpenPrompt 通过引入文本模板和动词化器（verbalizer），让用户只需设计合适的提示模板，即可直接调用预训练模型完成任务，显著降低了任务适配的门槛与成本。\n\n该工具特别适合 NLP 研究人员、算法工程师以及希望快速验证提示学习想法的开发者使用。它支持从 Hugging Face Transformers 直接加载主流预训练模型，并统一实现了多种提示构建方法、优化策略及生成式范式，甚至允许用户自定义模板语言与分词器组合，满足高度个性化的实验需求。此外，OpenPrompt 还持续扩展对新模型（如 OPT、ERNIE）和多框架（如 PaddlePaddle）的支持，并提供了丰富的教程与实战案例，包括如何结合 UltraChat 进行指令微调以构建聊天机器人。\n\n凭借模块化设计与高可扩展性，OpenPrompt 不仅便于复现前沿研究成果，也鼓励用户在此基础上创新","OpenPrompt 是一个专为“提示学习”（Prompt-learning）打造的开源框架，旨在帮助开发者更灵活、高效地将预训练语言模型适配到各类下游自然语言处理任务中。传统微调方法往往需要大量标注数据和计算资源，而 OpenPrompt 通过引入文本模板和动词化器（verbalizer），让用户只需设计合适的提示模板，即可直接调用预训练模型完成任务，显著降低了任务适配的门槛与成本。\n\n该工具特别适合 NLP 研究人员、算法工程师以及希望快速验证提示学习想法的开发者使用。它支持从 Hugging Face Transformers 直接加载主流预训练模型，并统一实现了多种提示构建方法、优化策略及生成式范式，甚至允许用户自定义模板语言与分词器组合，满足高度个性化的实验需求。此外，OpenPrompt 还持续扩展对新模型（如 OPT、ERNIE）和多框架（如 PaddlePaddle）的支持，并提供了丰富的教程与实战案例，包括如何结合 UltraChat 进行指令微调以构建聊天机器人。\n\n凭借模块化设计与高可扩展性，OpenPrompt 不仅便于复现前沿研究成果，也鼓励用户在此基础上创新探索，是推动提示学习从理论走向实践的重要工具之一。","\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_9b3c142860c0.png\" width=\"350px\">\n\n**An Open-Source Framework for Prompt-learning.**\n\n------\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#Overview\">Overview\u003C\u002Fa> •\n  \u003Ca href=\"#installation\">Installation\u003C\u002Fa> •\n  \u003Ca href=\"#use-openprompt\">How To Use\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Fthunlp.github.io\u002FOpenPrompt\u002F\">Docs\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.01998\">Paper\u003C\u002Fa> •\n  \u003Ca href=\"#citation\">Citation\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults\u002F\">Performance\u003C\u002Fa> •\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n![version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-v1.0.1-blue)\n\n\n\n\n## What's New?\n\n \n\n- ❗️ April 2023: $\\color{red}{\\normalsize{\\textbf{Want to build your Chat AI?}}}$ **We are releasing [UltraChat](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FUltraChat), use OpenPrompt and UltraChat to conduct supervised instruction tuning, see** [`.\u002Ftutorial\u002F9_UltraChat.py`](.\u002Ftutorial\u002F9_UltraChat.py).\n- Aug 2022: Thanks to contributor [zhiyongLiu1114](https:\u002F\u002Fgithub.com\u002FzhiyongLiu1114), OpenPrompt now supports [ERNIE 1.0](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Ftutorial\u002F7_ernie_paddlepaddle) in PaddlePaddle.\n- July 2022: OpenPrompt supports OPT now.\n- June 2022: OpenPrompt wins ACL 2022 Best Demo Paper Award.\n- Mar 2022: We add a [tutorial](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Ftutorial\u002F6.1_chinese_dataset_uer_t5.py) as the response to [issue 124](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F124), which uses a customized tokenizer_wrapper to perform tasks that are not in the default configuration of OpenPrompt (e.g., Bert tokenizer+T5 model）.\n- Feb 2022: Check out our sister repo [OpenDelta](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenDelta)!\n- Dec 2021: `pip install openprompt`\n- Dec 2021: [SuperGLUE performance](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults) are added\n- Dec 2021: We support **generation paradigm for all tasks** by adding a new verbalizer:[GenerationVerbalizer](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Fopenprompt\u002Fprompts\u002Fgeneration_verbalizer.py) and a [tutorial: 4.1_all_tasks_are_generation.py](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Ftutorial\u002F4.1_all_tasks_are_generation.py)\n- Nov 2021: Now we have released a paper [OpenPrompt: An Open-source Framework for Prompt-learning](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.01998).\n- Nov 2021 PrefixTuning supports t5 now.\n- Nov 2021: We made some major changes from the last version, where a flexible template language is newly introduced! Part of the docs is outdated and we will fix it soon.\n\n\n## Overview\n\n**Prompt-learning** is the latest paradigm to adapt pre-trained language models (PLMs) to downstream NLP tasks, which modifies the input text with a textual template and directly uses PLMs to conduct pre-trained tasks. This library provides a standard, flexible and extensible framework to deploy the prompt-learning pipeline. OpenPrompt supports loading PLMs directly from [huggingface transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers). In the future, we will also support PLMs implemented by other libraries. For more resources about prompt-learning, please check our [paper list](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FPromptPapers).\n\n\n\n\u003Cdiv align=\"center\">\n\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_469d8c65b0bb.png\" width=\"85%\" align=\"center\"\u002F>\n\n\u003C\u002Fdiv>\n\n\n\n## What Can You Do via OpenPrompt?\n\n\n\n![demo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_5d57a8e25b19.gif)\n\n\n\n- Use the implementations of current prompt-learning approaches.* We have implemented various of prompting methods, including templating, verbalizing and optimization strategies under a unified standard. You can easily call and understand these methods.\n- *Design your own prompt-learning work.* With the extensibility of OpenPrompt, you can quickly practice your prompt-learning ideas.\n\n\n\n\n## Installation\n\n**Note: Please use Python 3.8+ for OpenPrompt**\n\n### Using Pip\n\nOur repo is tested on Python **3.8+** and PyTorch **1.8.1+**, install OpenPrompt using pip as follows:\n\n\n\n\n```shell\npip install openprompt\n```\n\nTo play with the latest features, you can also install OpenPrompt from the source.\n\n### Using Git\n\nClone the repository from github:\n\n```shell\ngit clone https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt.git\ncd OpenPrompt\npip install -r requirements.txt\npython setup.py install\n```\n\nModify the code\n\n```\npython setup.py develop\n```\n\n\n\n## Use OpenPrompt\n\n### Base Concepts\n\nA  `PromptModel`  object contains a `PLM`, a (or multiple) `Template`  and a (or multiple) `Verbalizer`, where the `Template` class is defined to wrap the original input with templates, and the `Verbalizer` class is to construct a projection between labels and target words in the current vocabulary. And a `PromptModel`  object practically participates in training and inference.\n\n### Introduction by a Simple Example\n\nWith the modularity and flexibility of OpenPrompt, you can easily develop a prompt-learning pipeline.\n\n#### Step 1: Define a task\n\nThe first step is to determine the current NLP task, think about what’s your data looks like and what do you want from the data! That is, the essence of this step is to determine the `classes` and the `InputExample` of the task. For simplicity, we use Sentiment Analysis as an example. tutorial_task.\n\n```python\nfrom openprompt.data_utils import InputExample\nclasses = [ # There are two classes in Sentiment Analysis, one for negative and one for positive\n    \"negative\",\n    \"positive\"\n]\ndataset = [ # For simplicity, there's only two examples\n    # text_a is the input text of the data, some other datasets may have multiple input sentences in one example.\n    InputExample(\n        guid = 0,\n        text_a = \"Albert Einstein was one of the greatest intellects of his time.\",\n    ),\n    InputExample(\n        guid = 1,\n        text_a = \"The film was badly made.\",\n    ),\n]\n```\n\n\n\n#### Step 2: Define a Pre-trained Language Models (PLMs) as backbone.\n\nChoose a PLM to support your task. Different models have different attributes, we encourge you to use OpenPrompt to explore the potential of various PLMs. OpenPrompt is compatible with models on [huggingface](https:\u002F\u002Fhuggingface.co\u002Ftransformers\u002F).\n\n```python\nfrom openprompt.plms import load_plm\nplm, tokenizer, model_config, WrapperClass = load_plm(\"bert\", \"bert-base-cased\")\n```\n\n\n\n#### Step 3: Define a Template.\n\nA `Template` is a modifier of the original input text, which is also one of the most important modules in prompt-learning. \nWe have defined `text_a` in Step 1.\n\n```python\nfrom openprompt.prompts import ManualTemplate\npromptTemplate = ManualTemplate(\n    text = '{\"placeholder\":\"text_a\"} It was {\"mask\"}',\n    tokenizer = tokenizer,\n)\n```\n\n\n\n#### Step 4: Define a Verbalizer\n\nA `Verbalizer` is another important (but not necessary) in prompt-learning,which projects the original labels (we have defined them as `classes`, remember?) to a set of label words. Here is an example that we project the `negative` class to the word bad, and project the `positive` class to the words good, wonderful, great.\n\n```python\nfrom openprompt.prompts import ManualVerbalizer\npromptVerbalizer = ManualVerbalizer(\n    classes = classes,\n    label_words = {\n        \"negative\": [\"bad\"],\n        \"positive\": [\"good\", \"wonderful\", \"great\"],\n    },\n    tokenizer = tokenizer,\n)\n```\n\n\n\n#### Step 5: Combine them into a PromptModel\n\nGiven the task, now we have a `PLM`, a `Template` and a `Verbalizer`, we combine them into a `PromptModel`. Note that although the example naively combine the three modules, you can actually define some complicated interactions among them.\n\n```python\nfrom openprompt import PromptForClassification\npromptModel = PromptForClassification(\n    template = promptTemplate,\n    plm = plm,\n    verbalizer = promptVerbalizer,\n)\n```\n\n#### Step 6: Define a DataLoader\n\nA ``PromptDataLoader`` is basically a prompt version of pytorch Dataloader, which also includes a ``Tokenizer``, a ``Template`` and a ``TokenizerWrapper``.\n\n```python\nfrom openprompt import PromptDataLoader\ndata_loader = PromptDataLoader(\n    dataset = dataset,\n    tokenizer = tokenizer,\n    template = promptTemplate,\n    tokenizer_wrapper_class=WrapperClass,\n)\n```\n\n#### Step 7: Train and inference\n\nDone! We can conduct training and inference the same as other processes in Pytorch.\n\n\n```python\nimport torch\n\n# making zero-shot inference using pretrained MLM with prompt\npromptModel.eval()\nwith torch.no_grad():\n    for batch in data_loader:\n        logits = promptModel(batch)\n        preds = torch.argmax(logits, dim = -1)\n        print(classes[preds])\n# predictions would be 1, 0 for classes 'positive', 'negative'\n```\n\nPlease refer to our [tutorial scripts](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Ftutorial), and [documentation](https:\u002F\u002Fthunlp.github.io\u002FOpenPrompt\u002F) for more details.\n\n## Datasets\n\nWe provide a series of download scripts in the `dataset\u002F` folder, feel free to use them to download benchmarks.\n\n## Performance Report\nThere are too many possible combinations powered by OpenPrompt. We are trying our best\nto test the performance of different methods as soon as possible. The performance will be constantly updated into the [Tables](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults\u002F).\nWe also encourage the users to find the best hyper-parameters for their own tasks and report the results by making pull request.\n\n## Known Issues\nMajor improvement\u002Fenhancement in future.\n\n- We made some major changes from the last version, so part of the docs is outdated. We will fix it soon.\n\n## Citation\nPlease cite our paper if you use OpenPrompt in your work\n\n```bibtex\n@article{ding2021openprompt,\n  title={OpenPrompt: An Open-source Framework for Prompt-learning},\n  author={Ding, Ning and Hu, Shengding and Zhao, Weilin and Chen, Yulin and Liu, Zhiyuan and Zheng, Hai-Tao and Sun, Maosong},\n  journal={arXiv preprint arXiv:2111.01998},\n  year={2021}\n}\n```\n## Contributors\n\n\u003C!-- Copy-paste in your Readme.md file -->\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_5de791f8982f.png\" \u002F>\n\u003C\u002Fa>\n\nWe thank all the contributors to this project, more contributors are welcome!\n\n\n","\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_9b3c142860c0.png\" width=\"350px\">\n\n**一个用于提示学习的开源框架。**\n\n------\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#Overview\">概述\u003C\u002Fa> •\n  \u003Ca href=\"#installation\">安装\u003C\u002Fa> •\n  \u003Ca href=\"#use-openprompt\">使用方法\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Fthunlp.github.io\u002FOpenPrompt\u002F\">文档\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.01998\">论文\u003C\u002Fa> •\n  \u003Ca href=\"#citation\">引用\u003C\u002Fa> •\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults\u002F\">性能\u003C\u002Fa> •\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n![version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-v1.0.1-blue)\n\n\n\n\n## 最新动态？\n\n \n\n- ❗️ 2023年4月：$\\color{red}{\\normalsize{\\textbf{想构建你的聊天AI吗？}}}$ **我们发布了[UltraChat](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FUltraChat)，使用OpenPrompt和UltraChat进行监督式指令微调，请参阅** [`.\u002Ftutorial\u002F9_UltraChat.py`](.\u002Ftutorial\u002F9_UltraChat.py)。\n- 2022年8月：感谢贡献者[zhiyongLiu1114](https:\u002F\u002Fgithub.com\u002FzhiyongLiu1114)，OpenPrompt现在支持PaddlePaddle中的[ERNIE 1.0](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Ftutorial\u002F7_ernie_paddlepaddle)。\n- 2022年7月：OpenPrompt现在支持OPT。\n- 2022年6月：OpenPrompt荣获ACL 2022最佳演示论文奖。\n- 2022年3月：我们新增了一个[教程](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Ftutorial\u002F6.1_chinese_dataset_uer_t5.py)，以回应[issue 124](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F124)，该教程使用自定义的tokenizer_wrapper来执行OpenPrompt默认配置中未包含的任务（例如，Bert分词器+T5模型）。\n- 2022年2月：请查看我们的姊妹仓库[OpenDelta](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenDelta)！\n- 2021年12月：`pip install openprompt`\n- 2021年12月：增加了[SuperGLUE性能](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults)\n- 2021年12月：通过添加新的verbalizer：[GenerationVerbalizer](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Fopenprompt\u002Fprompts\u002Fgeneration_verbalizer.py)以及一个[教程：4.1_all_tasks_are_generation.py](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fblob\u002Fmain\u002Ftutorial\u002F4.1_all_tasks_are_generation.py)，我们支持**所有任务的生成范式**。\n- 2021年11月：我们现在发布了一篇论文[OpenPrompt：一个用于提示学习的开源框架](https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.01998)。\n- 2021年11月：PrefixTuning现在支持t5。\n- 2021年11月：我们对上一版本进行了重大更新，引入了灵活的模板语言！部分文档已过时，我们将尽快修复。\n\n\n## 概述\n\n**提示学习**是将预训练语言模型（PLMs）适配到下游NLP任务的最新范式，它通过文本模板修改输入文本，并直接利用PLMs完成预训练任务。本库提供了一个标准、灵活且可扩展的框架，用于部署提示学习流程。OpenPrompt支持直接从[huggingface transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers)加载PLMs。未来，我们还将支持其他库实现的PLMs。有关提示学习的更多资源，请参阅我们的[论文列表](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FPromptPapers)。\n\n\n\n\u003Cdiv align=\"center\">\n\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_469d8c65b0bb.png\" width=\"85%\" align=\"center\"\u002F>\n\n\u003C\u002Fdiv>\n\n\n\n## 通过OpenPrompt你能做什么？\n\n\n\n![demo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_5d57a8e25b19.gif)\n\n\n\n- 使用当前提示学习方法的实现。* 我们已经按照统一的标准实现了多种提示方法，包括模板化、语义映射和优化策略。你可以轻松调用并理解这些方法。\n- *设计你自己的提示学习工作。* 借助OpenPrompt的可扩展性，你可以快速实践自己的提示学习想法。\n\n\n\n\n## 安装\n\n**注意：请使用Python 3.8及以上版本运行OpenPrompt**\n\n### 使用Pip\n\n我们的仓库已在Python **3.8+** 和PyTorch **1.8.1+** 上测试通过，可通过以下方式使用pip安装OpenPrompt：\n\n\n\n```shell\npip install openprompt\n```\n\n若要体验最新功能，你也可以从源码安装OpenPrompt。\n\n### 使用Git\n\n从GitHub克隆仓库：\n\n```shell\ngit clone https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt.git\ncd OpenPrompt\npip install -r requirements.txt\npython setup.py install\n```\n\n若需修改代码：\n\n```shell\npython setup.py develop\n```\n\n\n\n## 使用OpenPrompt\n\n### 基础概念\n\n一个 `PromptModel` 对象包含一个 `PLM`、一个（或多个）`Template` 以及一个（或多个）`Verbalizer`。其中，`Template` 类用于将原始输入包裹在模板中，而 `Verbalizer` 类则负责在标签与当前词汇表中的目标词之间建立映射。一个 `PromptModel` 对象实际参与训练和推理过程。\n\n### 通过一个简单示例介绍\n\n借助 OpenPrompt 的模块化和灵活性，您可以轻松地构建一个提示学习流水线。\n\n#### 第一步：定义任务\n\n第一步是确定当前的 NLP 任务，思考您的数据是什么样的，以及您希望从这些数据中获得什么！也就是说，这一步的核心是确定任务的 `classes`（类别）和 `InputExample`（输入示例）。为了简单起见，我们以情感分析为例。 tutorial_task。\n\n```python\nfrom openprompt.data_utils import InputExample\nclasses = [ # 情感分析有两个类别，一个是负面，一个是正面\n    \"negative\",\n    \"positive\"\n]\ndataset = [ # 为了简单起见，这里只有两个示例\n    # text_a 是数据的输入文本，其他一些数据集可能在一个示例中包含多个输入句子。\n    InputExample(\n        guid = 0,\n        text_a = \"阿尔伯特·爱因斯坦是他那个时代最伟大的思想家之一。\",\n    ),\n    InputExample(\n        guid = 1,\n        text_a = \"这部电影拍得很糟糕。\",\n    ),\n]\n```\n\n\n\n#### 第二步：选择预训练语言模型（PLM）作为基础模型\n\n为您的任务选择一个合适的 PLM。不同的模型具有不同的特性，我们鼓励您使用 OpenPrompt 来探索各种 PLM 的潜力。OpenPrompt 兼容 [huggingface](https:\u002F\u002Fhuggingface.co\u002Ftransformers\u002F) 上的模型。\n\n```python\nfrom openprompt.plms import load_plm\nplm, tokenizer, model_config, WrapperClass = load_plm(\"bert\", \"bert-base-cased\")\n```\n\n\n\n#### 第三步：定义模板\n\n`Template`（模板）是对原始输入文本的一种修改方式，也是提示学习中最重要的一部分。我们在第一步中已经定义了 `text_a`。\n\n```python\nfrom openprompt.prompts import ManualTemplate\npromptTemplate = ManualTemplate(\n    text = '{\"placeholder\":\"text_a\"} It was {\"mask\"}',\n    tokenizer = tokenizer,\n)\n```\n\n\n\n#### 第四步：定义词表\n\n`Verbalizer`（词表）是提示学习中的另一个重要组成部分（但不是必需的），它将原始标签（我们之前定义为 `classes`，还记得吗？）映射到一组标签词。例如，我们将 `negative`（负面）类映射到“bad”这个词，而将 `positive`（正面）类映射到“good”、“wonderful”、“great”等词。\n\n```python\nfrom openprompt.prompts import ManualVerbalizer\npromptVerbalizer = ManualVerbalizer(\n    classes = classes,\n    label_words = {\n        \"negative\": [\"bad\"],\n        \"positive\": [\"good\", \"wonderful\", \"great\"],\n    },\n    tokenizer = tokenizer,\n)\n```\n\n\n\n#### 第五步：组合成 PromptModel\n\n有了任务、PLM、模板和词表之后，我们可以将它们组合成一个 `PromptModel`。需要注意的是，虽然这个例子只是简单地将三个模块组合在一起，但实际上您还可以定义它们之间更复杂的交互关系。\n\n```python\nfrom openprompt import PromptForClassification\npromptModel = PromptForClassification(\n    template = promptTemplate,\n    plm = plm,\n    verbalizer = promptVerbalizer,\n)\n```\n\n#### 第六步：定义数据加载器\n\n`PromptDataLoader` 基本上是 PyTorch 数据加载器的提示版本，它也包含了分词器、模板和分词器包装类。\n\n```python\nfrom openprompt import PromptDataLoader\ndata_loader = PromptDataLoader(\n    dataset = dataset,\n    tokenizer = tokenizer,\n    template = promptTemplate,\n    tokenizer_wrapper_class=WrapperClass,\n)\n```\n\n\n#### 第七步：训练与推理\n\n完成了！我们可以像在 PyTorch 中进行其他操作一样，进行训练和推理。\n\n\n```python\nimport torch\n\n# 使用带有提示的预训练 MLM 进行零样本推理\npromptModel.eval()\nwith torch.no_grad():\n    for batch in data_loader:\n        logits = promptModel(batch)\n        preds = torch.argmax(logits, dim = -1)\n        print(classes[preds])\n# 预测结果将是 1 和 0，分别对应 'positive' 和 'negative'\n```\n\n\n请参阅我们的[教程脚本](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Ftutorial)和[文档](https:\u002F\u002Fthunlp.github.io\u002FOpenPrompt\u002F)以获取更多详细信息。\n\n## 数据集\n\n我们在 `dataset\u002F` 文件夹中提供了一系列下载脚本，您可以随意使用它们来下载基准数据集。\n\n## 性能报告\nOpenPrompt 支持的组合方式非常多。我们正在尽最大努力尽快测试不同方法的性能，并会不断更新到[表格](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Fresults\u002F)中。我们也鼓励用户为自己的任务找到最佳超参数，并通过提交 Pull Request 报告结果。\n\n## 已知问题\n未来会有重大改进和增强。\n\n- 我们对上一版本进行了重大更改，因此部分文档已过时。我们会尽快修复。\n\n## 引用\n如果您在工作中使用了 OpenPrompt，请引用我们的论文：\n\n```bibtex\n@article{ding2021openprompt,\n  title={OpenPrompt: An Open-source Framework for Prompt-learning},\n  author={Ding, Ning and Hu, Shengding and Zhao, Weilin and Chen, Yulin and Liu, Zhiyuan and Zheng, Hai-Tao and Sun, Maosong},\n  journal={arXiv preprint arXiv:2111.01998},\n  year={2021}\n}\n```\n\n## 贡献者\n\n\u003C!-- 复制粘贴到您的 Readme.md 文件中 -->\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_readme_5de791f8982f.png\" \u002F>\n\u003C\u002Fa>\n\n我们感谢所有为该项目做出贡献的人士，同时也欢迎更多的贡献者！","# OpenPrompt 快速上手指南\n\nOpenPrompt 是一个开源的提示学习（Prompt-learning）框架，旨在帮助开发者灵活地将预训练语言模型（PLM）适配到各种下游 NLP 任务中。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux \u002F macOS \u002F Windows\n*   **Python 版本**：3.8 或更高版本 (**必须**)\n*   **PyTorch 版本**：1.8.1 或更高版本\n*   **依赖库**：`transformers` (用于加载 HuggingFace 模型)\n\n## 安装步骤\n\n您可以选择通过 pip 直接安装稳定版，或通过源码安装以获取最新功能。\n\n### 方式一：使用 Pip 安装（推荐）\n\n```shell\npip install openprompt\n```\n\n> **提示**：国内用户若下载较慢，可使用清华源加速：\n> `pip install openprompt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n### 方式二：从源码安装（获取最新特性）\n\n```shell\ngit clone https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt.git\ncd OpenPrompt\npip install -r requirements.txt\npython setup.py install\n```\n\n如果您需要修改源代码进行开发，请使用以下命令代替最后一步：\n```shell\npython setup.py develop\n```\n\n## 基本使用\n\nOpenPrompt 的核心流程包含七个步骤：定义任务、加载模型、定义模板、定义 verbalizer、组合模型、构建数据加载器、训练\u002F推理。\n\n以下是一个基于情感分析任务的零样本（Zero-shot）推理最小示例：\n\n### 1. 定义任务与数据\n首先确定分类类别并构建输入样本。\n\n```python\nfrom openprompt.data_utils import InputExample\n\nclasses = [ # 定义两个类别：负面和正面\n    \"negative\",\n    \"positive\"\n]\n\ndataset = [ # 构造简单的测试数据\n    InputExample(\n        guid = 0,\n        text_a = \"Albert Einstein was one of the greatest intellects of his time.\",\n    ),\n    InputExample(\n        guid = 1,\n        text_a = \"The film was badly made.\",\n    ),\n]\n```\n\n### 2. 加载预训练模型 (PLM)\n选择 backbone 模型（此处以 BERT 为例）。\n\n```python\nfrom openprompt.plms import load_plm\n\nplm, tokenizer, model_config, WrapperClass = load_plm(\"bert\", \"bert-base-cased\")\n```\n\n### 3. 定义模板 (Template)\n模板用于将原始输入转换为适合 PLM 处理的格式，`{\"mask\"}` 处为模型预测位置。\n\n```python\nfrom openprompt.prompts import ManualTemplate\n\npromptTemplate = ManualTemplate(\n    text = '{\"placeholder\":\"text_a\"} It was {\"mask\"}',\n    tokenizer = tokenizer,\n)\n```\n\n### 4. 定义 Verbalizer\nVerbalizer 将任务标签映射到词汇表中的具体单词。\n\n```python\nfrom openprompt.prompts import ManualVerbalizer\n\npromptVerbalizer = ManualVerbalizer(\n    classes = classes,\n    label_words = {\n        \"negative\": [\"bad\"],\n        \"positive\": [\"good\", \"wonderful\", \"great\"],\n    },\n    tokenizer = tokenizer,\n)\n```\n\n### 5. 组合 PromptModel\n将上述组件组合成一个完整的可训练\u002F推理模型。\n\n```python\nfrom openprompt import PromptForClassification\n\npromptModel = PromptForClassification(\n    template = promptTemplate,\n    plm = plm,\n    verbalizer = promptVerbalizer,\n)\n```\n\n### 6. 构建 DataLoader\n创建专门用于 Prompt 学习的数据加载器。\n\n```python\nfrom openprompt import PromptDataLoader\n\ndata_loader = PromptDataLoader(\n    dataset = dataset,\n    tokenizer = tokenizer,\n    template = promptTemplate,\n    tokenizer_wrapper_class=WrapperClass,\n)\n```\n\n### 7. 执行推理\n像使用普通 PyTorch 模型一样进行推理。\n\n```python\nimport torch\n\npromptModel.eval()\nwith torch.no_grad():\n    for batch in data_loader:\n        logits = promptModel(batch)\n        preds = torch.argmax(logits, dim = -1)\n        print(classes[preds])\n        \n# 预期输出：\n# positive\n# negative\n```\n\n更多高级用法（如微调训练、自定义模板、支持 T5\u002FOPT 等模型）请参考官方 [Tutorial](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Ftree\u002Fmain\u002Ftutorial) 和 [文档](https:\u002F\u002Fthunlp.github.io\u002FOpenPrompt\u002F)。","某电商公司的算法团队急需将最新的预训练语言模型适配到“用户评论情感分析”和“商品类别自动打标”两个下游任务中，以优化推荐系统。\n\n### 没有 OpenPrompt 时\n- **代码重复造轮子**：每次尝试新的 Prompt 方法（如 Prefix Tuning 或 P-tuning），都需要手动重写数据加载、模板构建和损失函数计算代码，开发效率极低。\n- **模型适配困难**：想要切换底层模型（例如从 BERT 换到 T5 或 OPT）时，由于不同模型的 Tokenizer 和输入格式差异巨大，往往需要大幅修改核心逻辑甚至推倒重来。\n- **实验对比繁琐**：缺乏统一的评估标准，难以在相同环境下公平对比不同提示学习策略的效果，导致调优方向模糊，资源浪费严重。\n- **生成任务支持弱**：面对需要文本生成的复杂任务，传统微调方式难以直接复用预训练模型的生成能力，需额外设计复杂的解码器结构。\n\n### 使用 OpenPrompt 后\n- **流水线标准化**：利用其统一的框架接口，团队成员只需几行代码即可调用多种前沿的 Prompt 学习方法，将新算法的验证周期从数天缩短至几小时。\n- **模型无缝切换**：借助对 Hugging Face 生态的原生支持，可以轻松在 BERT、T5、OPT 等多种架构间自由切换，仅需更改配置参数而无需重构代码。\n- **高效实验管理**：内置的标准化评估模块让不同提示策略的性能对比一目了然，帮助团队快速锁定最优方案，显著提升了模型迭代速度。\n- **全任务生成范式**：通过 GenerationVerbalizer 等组件，直接将分类等判别式任务转化为生成式任务，充分释放了预训练模型的潜力，提升了小样本场景下的准确率。\n\nOpenPrompt 通过提供标准化且高扩展性的提示学习框架，让算法团队能够以最低成本快速落地前沿 NLP 技术，显著加速了业务模型的迭代与上线。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthunlp_OpenPrompt_9b3c1428.png","thunlp","THUNLP","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fthunlp_13da7b2e.png","Natural Language Processing Lab at Tsinghua University",null,"thunlp@gmail.com","http:\u002F\u002Fnlp.csai.tsinghua.edu.cn","https:\u002F\u002Fgithub.com\u002Fthunlp",[82,86],{"name":83,"color":84,"percentage":85},"Python","#3572A5",99.6,{"name":87,"color":88,"percentage":89},"Shell","#89e051",0.4,4850,486,"2026-04-05T14:47:48","Apache-2.0","未说明",{"notes":96,"python":97,"dependencies":98},"该框架支持从 Hugging Face Transformers 加载预训练语言模型。部分文档可能因版本更新而过时。支持通过 PaddlePaddle 使用 ERNIE 1.0 模型。","3.8+",[99,100],"torch>=1.8.1","transformers",[13,14,15,35],[103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118],"nlp","pre-trained-language-models","ai","nlp-machine-learning","natural-language-processing","natural-language-understanding","deep-learning","pre-trained-model","nlp-library","pytorch","transformer","prompt","prompt-toolkit","prompts","prompt-based-tuning","prompt-learning","2026-03-27T02:49:30.150509","2026-04-07T00:47:03.249158",[122,127,132,137,142,147],{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},20609,"升级到 OpenPrompt 1.0.0 版本后，使用 ptr_template 报错 'TypeError: __init__() got an unexpected keyword argument 'placeholder_mapping'' 怎么办？","这是版本升级导致的参数不兼容问题。在 1.0.0 版本中，初始化模板时不再支持或改变了 'placeholder_mapping' 参数的传递方式。请检查您的代码，移除该参数或参考最新文档调整模板初始化代码。如果不确定如何修改，可以尝试回退到 0.1.1 版本临时解决，但建议尽快适配新版 API。","https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F142",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},20610,"加载中文 RoBERTa 模型（如 hfl\u002Fchinese-roberta-wwm-ext-large）时出现权重不匹配和类型错误如何解决？","该错误通常是因为模型类型指定错误或 Tokenizer 加载不当。确保在 load_plm 函数中正确指定模型类型（例如使用 'bert' 而不是 'roberta' 来加载某些中文 BERT 变体，或者确认该模型确实兼容 RobertaForMaskedLM）。错误信息显示部分权重未使用或新初始化，这可能是因为架构不完全匹配。建议检查模型配置文件，或尝试使用官方推荐的对应模型类型进行加载。","https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F251",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},20611,"运行教程 demo（如 tutorial\u002F1.1_mixed_template.py）时报错 'gather_outputs() takes 1 positional argument but 2 were given' 是什么原因？","这是一个已知的代码 Bug，已在开发分支（branch:dev）中修复。错误原因是 verbalizer 的 gather_outputs 方法定义与调用不匹配。解决方法是切换到 dev 分支运行代码：`git checkout dev`，或者等待官方发布包含该修复的新版本。不要直接在主分支的旧版本上运行该教程脚本。","https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F34",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},20612,"如何复现 ProtoVerb 实验中的单 verbalizer 模式？训练过程中是否排除了手动 verbalizer 的影响？","要复现单 verbalizer 模式的 ProtoVerb 实验，需要将训练参数 `train_verbalizer` 设置为 `alternate`。该设置会先训练原型（prototypes），然后将内部状态 `self.trained` 设为 True。在 `process_outputs` 函数中，当 `self.trained` 为 True 且 `multi_verb` 为 \"proto\" 时，系统将仅返回 `proto_logits`，从而在微调阶段排除手动 verbalizer 的干扰。无需删除代码行，只需正确配置参数即可。","https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F228",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},20613,"运行 LMBFF 教程时使用 T5Tokenizer 报错 'AttributeError: 'T5Tokenizer' object has no attribute 'tokenize_one_example'' 如何解决？","这是因为 T5Tokenizer 对象本身没有 `tokenize_one_example` 方法，该方法属于 OpenPrompt 封装的 wrapper 类。在初始化 PromptDataLoader 时，请确保传入的是正确的 tokenizer wrapper 对象（即经过 OpenPrompt 包装后的对象），而不是原始的 HuggingFace tokenizer。检查代码中 `template_tokenizer_wrapper` 变量的赋值，确保它是由 OpenPrompt 提供的对应 WrapperClass 生成的实例。","https:\u002F\u002Fgithub.com\u002Fthunlp\u002FOpenPrompt\u002Fissues\u002F138",{"id":148,"question_zh":149,"answer_zh":150,"source_url":131},20614,"如何使用 from_file 方法从文本文件加载多个自定义模板并在同一任务中使用？","`from_file` 不是类方法（classmethod），不能直接通过类名调用，需要实例化或使用正确的调用方式。此外，默认情况下 `from_file(path='...', choice=0)` 只导入文件中的第一行模板。若要在同一任务中使用文件中的所有模板，目前库的设计可能不支持直接一次性加载所有模板用于单个实例。您可能需要循环读取文件内容，为每个模板创建单独的实例，或者在数据预处理阶段根据需求动态分配不同的模板实例给不同的数据样本。",[152,157,162,166],{"id":153,"version":154,"summary_zh":155,"released_at":156},126606,"v1.0.0","这是 OpenPrompt 的 1.0.0 版本。","2022-04-20T04:58:40",{"id":158,"version":159,"summary_zh":160,"released_at":161},126607,"v0.1.2","此版本包含关于模板类使用的一些更新。","2021-12-09T10:03:18",{"id":163,"version":164,"summary_zh":77,"released_at":165},126608,"v0.1.1","2021-12-04T03:22:21",{"id":167,"version":168,"summary_zh":169,"released_at":170},126609,"v0.0.1-beta","首次发布","2021-10-05T05:52:02"]