[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-NTMC-Community--MatchZoo-py":3,"tool-NTMC-Community--MatchZoo-py":64},[4,17,27,35,43,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},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 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"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,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"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,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"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,26,54],{"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":92,"forks":93,"last_commit_at":94,"license":95,"difficulty_score":23,"env_os":96,"env_gpu":97,"env_ram":97,"env_deps":98,"category_tags":103,"github_topics":104,"view_count":112,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":113,"updated_at":114,"faqs":115,"releases":146},169,"NTMC-Community\u002FMatchZoo-py","MatchZoo-py","Facilitating the design, comparison and sharing of deep text matching models.","MatchZoo-py 是一个基于 PyTorch 的开源工具包，专注于深度文本匹配模型的开发与研究。它支持多种典型任务，如问答匹配、对话响应排序、复述识别、文本蕴含判断和信息检索等，这些任务的核心都是判断两段文本之间的语义相关性。MatchZoo-py 通过统一的数据处理流程、模块化的模型配置接口以及内置的损失函数与评估指标，显著降低了实现和比较不同文本匹配模型的门槛。研究人员和开发者可以快速复现经典模型（如 DSSM）、尝试新结构，或在标准数据集上进行公平对比。其设计注重灵活性与可扩展性，同时提供自动超参调优等实用功能，适合自然语言处理领域的科研人员和工程师使用。普通用户或非技术背景人士则不太需要直接接触该工具。","\u003Cdiv align='center'>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_c42f170a8b57.png\" width = \"400\"  alt=\"logo\" align=\"center\" \u002F>\n\u003C\u002Fdiv>\n\n# MatchZoo-py [![Tweet](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Furl\u002Fhttp\u002Fshields.io.svg?style=social)](https:\u002F\u002Ftwitter.com\u002Fintent\u002Ftweet?text=MatchZoo-py:%20deep%20learning%20for%20semantic%20matching&url=https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py)\n\n> PyTorch version of [MatchZoo](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo).\n\n> Facilitating the design, comparison and sharing of deep text matching models.\u003Cbr\u002F>\n> MatchZoo 是一个通用的文本匹配工具包，它旨在方便大家快速的实现、比较、以及分享最新的深度文本匹配模型。\n\n[![Python 3.6](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.6%20%7C%203.7-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Frelease\u002Fpython-360\u002F)\n[![Pypi Downloads](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fmatchzoo-py.svg?label=pypi)](https:\u002F\u002Fpypi.org\u002Fproject\u002FMatchZoo-py\u002F)\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_13d664e1afd7.png)](https:\u002F\u002Fmatchzoo-py.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest)\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002FNTMC-Community\u002FMatchZoo-py.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002FNTMC-Community\u002FMatchZoo-py)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002FNTMC-Community\u002FMatchZoo-py\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002FNTMC-Community\u002FMatchZoo-py)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-blue.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n[![Requirements Status](https:\u002F\u002Frequires.io\u002Fgithub\u002FNTMC-Community\u002FMatchZoo-py\u002Frequirements.svg?branch=master)](https:\u002F\u002Frequires.io\u002Fgithub\u002FNTMC-Community\u002FMatchZoo-py\u002Frequirements\u002F?branch=master)\n[![Gitter](https:\u002F\u002Fbadges.gitter.im\u002FNTMC-Community\u002Fcommunity.svg)](https:\u002F\u002Fgitter.im\u002FNTMC-Community\u002Fcommunity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n---\n\nThe goal of MatchZoo is to provide a high-quality codebase for deep text matching research, such as document retrieval, question answering, conversational response ranking, and paraphrase identification. With the unified data processing pipeline, simplified model configuration and automatic hyper-parameters tunning features equipped, MatchZoo is flexible and easy to use.\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Cth width=30%, bgcolor=#999999 >Tasks\u003C\u002Fth> \n    \u003Cth width=20%, bgcolor=#999999>Text 1\u003C\u002Fth>\n    \u003Cth width=\"20%\", bgcolor=#999999>Text 2\u003C\u002Fth>\n    \u003Cth width=\"20%\", bgcolor=#999999>Objective\u003C\u002Fth>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> Paraphrase Indentification \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> string 1 \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> string 2 \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> classification \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> Textual Entailment \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> text \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> hypothesis \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> classification \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> Question Answer \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> question \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> answer \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> classification\u002Franking \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> Conversation \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> dialog \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> response \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> classification\u002Franking \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> Information Retrieval \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> query \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> document \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> ranking \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n## Get Started in 60 Seconds\n\nTo train a [Deep Semantic Structured Model](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fproject\u002Fdssm\u002F), make use of MatchZoo customized loss functions and evaluation metrics to define a task:\n\n```python\nimport torch\nimport matchzoo as mz\n\nranking_task = mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=4))\nranking_task.metrics = [\n    mz.metrics.NormalizedDiscountedCumulativeGain(k=3),\n    mz.metrics.MeanAveragePrecision()\n]\n```\n\nPrepare input data:\n\n```python\ntrain_pack = mz.datasets.wiki_qa.load_data('train', task=ranking_task)\nvalid_pack = mz.datasets.wiki_qa.load_data('dev', task=ranking_task)\n```\n\nPreprocess your input data in three lines of code, keep track parameters to be passed into the model:\n\n```python\npreprocessor = mz.models.ArcI.get_default_preprocessor()\ntrain_processed = preprocessor.fit_transform(train_pack)\nvalid_processed = preprocessor.transform(valid_pack)\n```\n\nGenerate pair-wise training data on-the-fly:\n```python\ntrainset = mz.dataloader.Dataset(\n    data_pack=train_processed,\n    mode='pair',\n    num_dup=1,\n    num_neg=4,\n    batch_size=32\n)\nvalidset = mz.dataloader.Dataset(\n    data_pack=valid_processed,\n    mode='point',\n    batch_size=32\n)\n```\n\nDefine padding callback and generate data loader:\n```python\npadding_callback = mz.models.ArcI.get_default_padding_callback()\n\ntrainloader = mz.dataloader.DataLoader(\n    dataset=trainset,\n    stage='train',\n    callback=padding_callback\n)\nvalidloader = mz.dataloader.DataLoader(\n    dataset=validset,\n    stage='dev',\n    callback=padding_callback\n)\n```\n\nInitialize the model, fine-tune the hyper-parameters:\n\n```python\nmodel = mz.models.ArcI()\nmodel.params['task'] = ranking_task\nmodel.params['embedding_output_dim'] = 100\nmodel.params['embedding_input_dim'] = preprocessor.context['embedding_input_dim']\nmodel.guess_and_fill_missing_params()\nmodel.build()\n```\n\n`Trainer` is used to control the training flow:\n\n```python\noptimizer = torch.optim.Adam(model.parameters())\n\ntrainer = mz.trainers.Trainer(\n    model=model,\n    optimizer=optimizer,\n    trainloader=trainloader,\n    validloader=validloader,\n    epochs=10\n)\n\ntrainer.run()\n```\n\n## References\n[Tutorials](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Ftutorials)\n\n[English Documentation](https:\u002F\u002Fmatchzoo-py.readthedocs.io\u002Fen\u002Flatest\u002F)\n\nIf you're interested in the cutting-edge research progress, please take a look at [awaresome neural models for semantic match](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002Fawaresome-neural-models-for-semantic-match).\n\n## Install\n\nMatchZoo-py is dependent on [PyTorch](https:\u002F\u002Fpytorch.org). Two ways to install MatchZoo-py:\n\n**Install MatchZoo-py from Pypi:**\n\n```python\npip install matchzoo-py\n```\n\n**Install MatchZoo-py from the Github source:**\n\n```\ngit clone https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py.git\ncd MatchZoo-py\npython setup.py install\n```\n\n\n## Models\n\n- [DRMM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdrmm.py): this model is an implementation of \u003Ca href=\"http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~gjf\u002Fpapers\u002F2016\u002FCIKM2016a_guo.pdf\">A Deep Relevance Matching Model for Ad-hoc Retrieval\u003C\u002Fa>.\n- [DRMMTKS](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdrmmtks.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-3-030-01012-6_2\">A Deep Top-K Relevance Matching Model for Ad-hoc Retrieval\u003C\u002Fa>.\n- [ARC-I](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Farci.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1503.03244\">Convolutional Neural Network Architectures for Matching Natural Language Sentences\u003C\u002Fa>\n- [ARC-II](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Farcii.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1503.03244\">Convolutional Neural Network Architectures for Matching Natural Language Sentences\u003C\u002Fa>\n- [DSSM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdssm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fwp-content\u002Fuploads\u002F2016\u002F02\u002Fcikm2013_DSSM_fullversion.pdf\">Learning Deep Structured Semantic Models for Web Search using Clickthrough Data\u003C\u002Fa>\n- [CDSSM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fcdssm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpublication\u002Flearning-semantic-representations-using-convolutional-neural-networks-for-web-search\u002F\">Learning Semantic Representations Using Convolutional Neural Networks for Web Search\u003C\u002Fa>\n- [MatchLSTM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatchlstm.py):this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1608.07905\">Machine Comprehension Using Match-LSTM and Answer Pointer\u003C\u002Fa>\n- [DUET](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fduet.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Fdl.acm.org\u002Fcitation.cfm?id=3052579\">Learning to Match Using Local and Distributed Representations of Text for Web Search\u003C\u002Fa>\n- [KNRM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fknrm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.06613\">End-to-End Neural Ad-hoc Ranking with Kernel Pooling\u003C\u002Fa>\n- [ConvKNRM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fconv_knrm.py): this model is an implementation of \u003Ca href=\"http:\u002F\u002Fwww.cs.cmu.edu\u002F~zhuyund\u002Fpapers\u002FWSDM_2018_Dai.pdf\">Convolutional neural networks for soft-matching n-grams in ad-hoc search\u003C\u002Fa>\n- [ESIM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fesim.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1609.06038\">Enhanced LSTM for Natural Language Inference\u003C\u002Fa>\n- [BiMPM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fbimpm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1702.03814\">Bilateral Multi-Perspective Matching for Natural Language Sentences\u003C\u002Fa>\n- [MatchPyramid](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatch_pyramid.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1602.06359\">Text Matching as Image Recognition\u003C\u002Fa>\n- [Match-SRNN](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatch_srnn.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1604.04378\">Match-SRNN: Modeling the Recursive Matching Structure with Spatial RNN\u003C\u002Fa>\n- [aNMM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fanmm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1801.01641\">aNMM: Ranking Short Answer Texts with Attention-Based Neural Matching Model\u003C\u002Fa>\n- [MV-LSTM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmvlstm.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fpdf\u002F1511.08277.pdf\">A Deep Architecture for Semantic Matching with Multiple Positional Sentence Representations\u003C\u002Fa>\n- [DIIN](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdiin.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fpdf\u002F1709.04348.pdf\">Natural Lanuguage Inference Over Interaction Space\u003C\u002Fa>\n- [HBMP](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fhbmp.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fpdf\u002F1808.08762.pdf\">Sentence Embeddings in NLI with Iterative Refinement Encoders\u003C\u002Fa>\n- [BERT](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fbert.py): this model is an implementation of \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.04805\">BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding\u003C\u002Fa>\n\n\n## Citation\n\nIf you use MatchZoo in your research, please use the following BibTex entry.\n\n```\n@inproceedings{Guo:2019:MLP:3331184.3331403,\n author = {Guo, Jiafeng and Fan, Yixing and Ji, Xiang and Cheng, Xueqi},\n title = {MatchZoo: A Learning, Practicing, and Developing System for Neural Text Matching},\n booktitle = {Proceedings of the 42Nd International ACM SIGIR Conference on Research and Development in Information Retrieval},\n series = {SIGIR'19},\n year = {2019},\n isbn = {978-1-4503-6172-9},\n location = {Paris, France},\n pages = {1297--1300},\n numpages = {4},\n url = {http:\u002F\u002Fdoi.acm.org\u002F10.1145\u002F3331184.3331403},\n doi = {10.1145\u002F3331184.3331403},\n acmid = {3331403},\n publisher = {ACM},\n address = {New York, NY, USA},\n keywords = {matchzoo, neural network, text matching},\n} \n```\n\n\n## Development Team\n\n ​ ​ ​ ​\n\u003Ctable border=\"0\">\n  \u003Ctbody>\n    \u003Ctr align=\"center\">\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffaneshion\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_7fda19caeb87.png\" alt=\"faneshion\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~fanyixing\u002F\">Yixing Fan\u003C\u002Fa> ​\n        \u003Cp>Core Dev\u003Cbr>\n        ASST PROF, ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChriskuei\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_df14c052da70.png\" alt=\"Chriskuei\">\u003C\u002Fa>\u003Cbr>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChriskuei\">Jiangui Chen\u003C\u002Fa> ​\n        \u003Cp>Core Dev\u003Cbr> PhD. ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcaiyinqiong\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_72bfa4b26076.png\" alt=\"caiyinqiong\">\u003C\u002Fa>\u003Cbr>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcaiyinqiong\">Yinqiong Cai\u003C\u002Fa>\n         \u003Cp>Core Dev\u003Cbr> M.S. ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpl8787\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_492e45e1fab3.png\" alt=\"pl8787\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpl8787\">Liang Pang\u003C\u002Fa> ​\n        \u003Cp>Core Dev\u003Cbr>\n        ASST PROF, ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flixinsu\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_200e6129a7dc.png\" alt=\"lixinsu\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flixinsu\">Lixin Su\u003C\u002Fa>\n        \u003Cp>Dev\u003Cbr>\n        PhD. ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr align=\"center\">\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChrisRBXiong\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_d83e406ffceb.png\" alt=\"ChrisRBXiong\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChrisRBXiong\">Ruibin Xiong\u003C\u002Fa> ​\n        \u003Cp>Dev\u003Cbr>\n        M.S. ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdyuyang\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_a8364648843c.png\" alt=\"dyuyang\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdyuyang\">Yuyang Ding\u003C\u002Fa> ​\n        \u003Cp>Dev\u003Cbr>\n        M.S. ICT\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Frgtjf\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_02624e8e77b9.png\" alt=\"rgtjf\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Frgtjf\">Junfeng Tian\u003C\u002Fa> ​\n        \u003Cp>Dev\u003Cbr>\n        M.S. ECNU\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fwqh17101\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_5f9cf02eefb0.png\" alt=\"wqh17101\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fwqh17101\">Qinghua Wang\u003C\u002Fa> ​\n        \u003Cp>Documentation\u003Cbr>\n        B.S. Shandong Univ.\u003C\u002Fp>​\n      \u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\n\n\n## Contribution\n\nPlease make sure to read the [Contributing Guide](.\u002FCONTRIBUTING.md) before creating a pull request. If you have a MatchZoo-related paper\u002Fproject\u002Fcompnent\u002Ftool, send a pull request to [this awesome list](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002Fawaresome-neural-models-for-semantic-match)!\n\nThank you to all the people who already contributed to MatchZoo!\n\n[Bo Wang](https:\u002F\u002Fgithub.com\u002Fbwanglzu), [Zeyi Wang](https:\u002F\u002Fgithub.com\u002Fuduse), [Liu Yang](https:\u002F\u002Fgithub.com\u002Fyangliuy), [Zizhen Wang](https:\u002F\u002Fgithub.com\u002FZizhenWang), [Zhou Yang](https:\u002F\u002Fgithub.com\u002Fzhouzhouyang520), [Jianpeng Hou](https:\u002F\u002Fgithub.com\u002FHouJP), [Lijuan Chen](https:\u002F\u002Fgithub.com\u002Fgithubclj), [Yukun Zheng](https:\u002F\u002Fgithub.com\u002Fzhengyk11), [Niuguo Cheng](https:\u002F\u002Fgithub.com\u002Fniuox), [Dai Zhuyun](https:\u002F\u002Fgithub.com\u002FAdeDZY), [Aneesh Joshi](https:\u002F\u002Fgithub.com\u002Faneesh-joshi), [Zeno Gantner](https:\u002F\u002Fgithub.com\u002Fzenogantner), [Kai Huang](https:\u002F\u002Fgithub.com\u002Fhkvision), [stanpcf](https:\u002F\u002Fgithub.com\u002Fstanpcf), [ChangQF](https:\u002F\u002Fgithub.com\u002FChangQF), [Mike Kellogg\n](https:\u002F\u002Fgithub.com\u002Fwordreference)\n\n\n\n\n## Project Organizers\n\n- Jiafeng Guo\n  * Institute of Computing Technology, Chinese Academy of Sciences\n  * [Homepage](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~gjf\u002F)\n- Yanyan Lan\n  * Institute of Computing Technology, Chinese Academy of Sciences\n  * [Homepage](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~lanyanyan\u002F)\n- Xueqi Cheng\n  * Institute of Computing Technology, Chinese Academy of Sciences\n  * [Homepage](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~cxq\u002F)\n\n\n## License\n\n[Apache-2.0](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n\nCopyright (c) 2019-present, Yixing Fan (faneshion)\n","\u003Cdiv align='center'>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_c42f170a8b57.png\" width = \"400\"  alt=\"logo\" align=\"center\" \u002F>\n\u003C\u002Fdiv>\n\n# MatchZoo-py [![Tweet](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Furl\u002Fhttp\u002Fshields.io.svg?style=social)](https:\u002F\u002Ftwitter.com\u002Fintent\u002Ftweet?text=MatchZoo-py:%20deep%20learning%20for%20semantic%20matching&url=https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py)\n\n> [MatchZoo](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo) 的 PyTorch 版本。\n\n> 旨在促进深度文本匹配（deep text matching）模型的设计、比较与共享。\u003Cbr\u002F>\n> MatchZoo 是一个通用的文本匹配工具包，它旨在方便大家快速地实现、比较以及分享最新的深度文本匹配模型。\n\n[![Python 3.6](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.6%20%7C%203.7-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Frelease\u002Fpython-360\u002F)\n[![Pypi Downloads](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fmatchzoo-py.svg?label=pypi)](https:\u002F\u002Fpypi.org\u002Fproject\u002FMatchZoo-py\u002F)\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_13d664e1afd7.png)](https:\u002F\u002Fmatchzoo-py.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest)\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002FNTMC-Community\u002FMatchZoo-py.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002FNTMC-Community\u002FMatchZoo-py)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002FNTMC-Community\u002FMatchZoo-py\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002FNTMC-Community\u002FMatchZoo-py)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-blue.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n[![Requirements Status](https:\u002F\u002Frequires.io\u002Fgithub\u002FNTMC-Community\u002FMatchZoo-py\u002Frequirements.svg?branch=master)](https:\u002F\u002Frequires.io\u002Fgithub\u002FNTMC-Community\u002FMatchZoo-py\u002Frequirements\u002F?branch=master)\n[![Gitter](https:\u002F\u002Fbadges.gitter.im\u002FNTMC-Community\u002Fcommunity.svg)](https:\u002F\u002Fgitter.im\u002FNTMC-Community\u002Fcommunity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n---\n\nMatchZoo 的目标是为深度文本匹配研究（如文档检索、问答系统、对话响应排序和复述识别等任务）提供高质量的代码基础。借助统一的数据处理流程、简化的模型配置以及自动超参数调优等功能，MatchZoo 具有高度的灵活性和易用性。\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Cth width=30%, bgcolor=#999999 >任务（Tasks）\u003C\u002Fth> \n    \u003Cth width=20%, bgcolor=#999999>文本 1（Text 1）\u003C\u002Fth>\n    \u003Cth width=\"20%\", bgcolor=#999999>文本 2（Text 2）\u003C\u002Fth>\n    \u003Cth width=\"20%\", bgcolor=#999999>目标（Objective）\u003C\u002Fth>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 复述识别（Paraphrase Identification） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 字符串 1 \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 字符串 2 \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 分类（classification） \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 文本蕴含（Textual Entailment） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 文本（text） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 假设（hypothesis） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 分类（classification） \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 问答（Question Answering） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 问题（question） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 答案（answer） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 分类\u002F排序（classification\u002Franking） \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 对话（Conversation） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 对话（dialog） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 回复（response） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 分类\u002F排序（classification\u002Franking） \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 信息检索（Information Retrieval） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 查询（query） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 文档（document） \u003C\u002Ftd>\n    \u003Ctd align=\"center\", bgcolor=#eeeeee> 排序（ranking） \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n## 60 秒快速入门\n\n要训练一个 [Deep Semantic Structured Model (DSSM)](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fproject\u002Fdssm\u002F)，可以使用 MatchZoo 提供的自定义损失函数和评估指标来定义任务：\n\n```python\nimport torch\nimport matchzoo as mz\n\nranking_task = mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=4))\nranking_task.metrics = [\n    mz.metrics.NormalizedDiscountedCumulativeGain(k=3),\n    mz.metrics.MeanAveragePrecision()\n]\n```\n\n准备输入数据：\n\n```python\ntrain_pack = mz.datasets.wiki_qa.load_data('train', task=ranking_task)\nvalid_pack = mz.datasets.wiki_qa.load_data('dev', task=ranking_task)\n```\n\n仅需三行代码即可预处理输入数据，并记录需要传入模型的参数：\n\n```python\npreprocessor = mz.models.ArcI.get_default_preprocessor()\ntrain_processed = preprocessor.fit_transform(train_pack)\nvalid_processed = preprocessor.transform(valid_pack)\n```\n\n动态生成成对（pair-wise）训练数据：\n```python\ntrainset = mz.dataloader.Dataset(\n    data_pack=train_processed,\n    mode='pair',\n    num_dup=1,\n    num_neg=4,\n    batch_size=32\n)\nvalidset = mz.dataloader.Dataset(\n    data_pack=valid_processed,\n    mode='point',\n    batch_size=32\n)\n```\n\n定义填充回调函数（padding callback）并生成数据加载器（data loader）：\n```python\npadding_callback = mz.models.ArcI.get_default_padding_callback()\n\ntrainloader = mz.dataloader.DataLoader(\n    dataset=trainset,\n    stage='train',\n    callback=padding_callback\n)\nvalidloader = mz.dataloader.DataLoader(\n    dataset=validset,\n    stage='dev',\n    callback=padding_callback\n)\n```\n\n初始化模型并微调超参数：\n\n```python\nmodel = mz.models.ArcI()\nmodel.params['task'] = ranking_task\nmodel.params['embedding_output_dim'] = 100\nmodel.params['embedding_input_dim'] = preprocessor.context['embedding_input_dim']\nmodel.guess_and_fill_missing_params()\nmodel.build()\n```\n\n使用 `Trainer` 控制训练流程：\n\n```python\noptimizer = torch.optim.Adam(model.parameters())\n\ntrainer = mz.trainers.Trainer(\n    model=model,\n    optimizer=optimizer,\n    trainloader=trainloader,\n    validloader=validloader,\n    epochs=10\n)\n\ntrainer.run()\n```\n\n## 参考资料\n[教程（Tutorials）](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Ftutorials)\n\n[英文文档（English Documentation）](https:\u002F\u002Fmatchzoo-py.readthedocs.io\u002Fen\u002Flatest\u002F)\n\n如果您对前沿研究进展感兴趣，请查看 [awesome neural models for semantic match](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002Fawaresome-neural-models-for-semantic-match)。\n\n## 安装\n\nMatchZoo-py 依赖于 [PyTorch](https:\u002F\u002Fpytorch.org)。有两种方式安装 MatchZoo-py：\n\n**从 PyPI 安装 MatchZoo-py：**\n\n```python\npip install matchzoo-py\n```\n\n**从 GitHub 源码安装 MatchZoo-py：**\n\n```\ngit clone https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py.git\ncd MatchZoo-py\npython setup.py install\n```\n\n## 模型（Models）\n\n- [DRMM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdrmm.py)：该模型实现了论文《[A Deep Relevance Matching Model for Ad-hoc Retrieval](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~gjf\u002Fpapers\u002F2016\u002FCIKM2016a_guo.pdf)》（面向即席检索的深度相关性匹配模型）。\n- [DRMMTKS](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdrmmtks.py)：该模型实现了论文《[A Deep Top-K Relevance Matching Model for Ad-hoc Retrieval](https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-3-030-01012-6_2)》（面向即席检索的深度 Top-K 相关性匹配模型）。\n- [ARC-I](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Farci.py)：该模型实现了论文《[Convolutional Neural Network Architectures for Matching Natural Language Sentences](https:\u002F\u002Farxiv.org\u002Fabs\u002F1503.03244)》（用于匹配自然语言句子的卷积神经网络架构）。\n- [ARC-II](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Farcii.py)：该模型实现了论文《[Convolutional Neural Network Architectures for Matching Natural Language Sentences](https:\u002F\u002Farxiv.org\u002Fabs\u002F1503.03244)》（用于匹配自然 language 句子的卷积神经网络架构）。\n- [DSSM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdssm.py)：该模型实现了论文《[Learning Deep Structured Semantic Models for Web Search using Clickthrough Data](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fwp-content\u002Fuploads\u002F2016\u002F02\u002Fcikm2013_DSSM_fullversion.pdf)》（利用点击数据学习用于网络搜索的深度结构化语义模型）。\n- [CDSSM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fcdssm.py)：该模型实现了论文《[Learning Semantic Representations Using Convolutional Neural Networks for Web Search](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpublication\u002Flearning-semantic-representations-using-convolutional-neural-networks-for-web-search\u002F)》（使用卷积神经网络学习用于网络搜索的语义表示）。\n- [MatchLSTM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatchlstm.py)：该模型实现了论文《[Machine Comprehension Using Match-LSTM and Answer Pointer](https:\u002F\u002Farxiv.org\u002Fabs\u002F1608.07905)》（使用 Match-LSTM 和答案指针的机器阅读理解）。\n- [DUET](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fduet.py)：该模型实现了论文《[Learning to Match Using Local and Distributed Representations of Text for Web Search](https:\u002F\u002Fdl.acm.org\u002Fcitation.cfm?id=3052579)》（利用文本的局部和分布式表示进行网络搜索匹配学习）。\n- [KNRM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fknrm.py)：该模型实现了论文《[End-to-End Neural Ad-hoc Ranking with Kernel Pooling](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.06613)》（基于核池化的端到端神经即席排序）。\n- [ConvKNRM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fconv_knrm.py)：该模型实现了论文《[Convolutional neural networks for soft-matching n-grams in ad-hoc search](http:\u002F\u002Fwww.cs.cmu.edu\u002F~zhuyund\u002Fpapers\u002FWSDM_2018_Dai.pdf)》（用于即席搜索中 n-gram 软匹配的卷积神经网络）。\n- [ESIM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fesim.py)：该模型实现了论文《[Enhanced LSTM for Natural Language Inference](https:\u002F\u002Farxiv.org\u002Fabs\u002F1609.06038)》（用于自然语言推理的增强型 LSTM）。\n- [BiMPM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fbimpm.py)：该模型实现了论文《[Bilateral Multi-Perspective Matching for Natural Language Sentences](https:\u002F\u002Farxiv.org\u002Fabs\u002F1702.03814)》（自然语言句子的双边多视角匹配）。\n- [MatchPyramid](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatch_pyramid.py)：该模型实现了论文《[Text Matching as Image Recognition](https:\u002F\u002Farxiv.org\u002Fabs\u002F1602.06359)》（将文本匹配视为图像识别）。\n- [Match-SRNN](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmatch_srnn.py)：该模型实现了论文《[Match-SRNN: Modeling the Recursive Matching Structure with Spatial RNN](https:\u002F\u002Farxiv.org\u002Fabs\u002F1604.04378)》（Match-SRNN：利用空间 RNN 建模递归匹配结构）。\n- [aNMM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fanmm.py)：该模型实现了论文《[aNMM: Ranking Short Answer Texts with Attention-Based Neural Matching Model](https:\u002F\u002Farxiv.org\u002Fabs\u002F1801.01641)》（aNMM：基于注意力机制的神经匹配模型对短答案文本进行排序）。\n- [MV-LSTM](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fmvlstm.py)：该模型实现了论文《[A Deep Architecture for Semantic Matching with Multiple Positional Sentence Representations](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1511.08277.pdf)》（基于多重位置句子表示的语义匹配深度架构）。\n- [DIIN](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fdiin.py)：该模型实现了论文《[Natural Language Inference Over Interaction Space](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1709.04348.pdf)》（在交互空间中的自然语言推理）。\n- [HBMP](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fhbmp.py)：该模型实现了论文《[Sentence Embeddings in NLI with Iterative Refinement Encoders](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1808.08762.pdf)》（在自然语言推理（NLI）中使用迭代精炼编码器的句子嵌入）。\n- [BERT](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Fmatchzoo\u002Fmodels\u002Fbert.py)：该模型实现了论文《[BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.04805)》（BERT：用于语言理解的深度双向 Transformer 预训练）。\n\n## 引用（Citation）\n\n如果您在研究中使用了 MatchZoo，请引用以下 BibTex 条目：\n\n```\n@inproceedings{Guo:2019:MLP:3331184.3331403,\n author = {Guo, Jiafeng and Fan, Yixing and Ji, Xiang and Cheng, Xueqi},\n title = {MatchZoo: A Learning, Practicing, and Developing System for Neural Text Matching},\n booktitle = {Proceedings of the 42Nd International ACM SIGIR Conference on Research and Development in Information Retrieval},\n series = {SIGIR'19},\n year = {2019},\n isbn = {978-1-4503-6172-9},\n location = {Paris, France},\n pages = {1297--1300},\n numpages = {4},\n url = {http:\u002F\u002Fdoi.acm.org\u002F10.1145\u002F3331184.3331403},\n doi = {10.1145\u002F3331184.3331403},\n acmid = {3331403},\n publisher = {ACM},\n address = {New York, NY, USA},\n keywords = {matchzoo, neural network, text matching},\n} \n```\n\n## 开发团队\n\n ​ ​ ​ ​\n\u003Ctable border=\"0\">\n  \u003Ctbody>\n    \u003Ctr align=\"center\">\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffaneshion\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_7fda19caeb87.png\" alt=\"faneshion\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~fanyixing\u002F\">樊毅星\u003C\u002Fa> ​\n        \u003Cp>核心开发者\u003Cbr>\n        中科院计算所 助理教授\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChriskuei\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_df14c052da70.png\" alt=\"Chriskuei\">\u003C\u002Fa>\u003Cbr>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChriskuei\">陈江贵\u003C\u002Fa> ​\n        \u003Cp>核心开发者\u003Cbr> 中科院计算所 博士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcaiyinqiong\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_72bfa4b26076.png\" alt=\"caiyinqiong\">\u003C\u002Fa>\u003Cbr>\n         \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcaiyinqiong\">蔡银琼\u003C\u002Fa>\n         \u003Cp>核心开发者\u003Cbr> 中科院计算所 硕士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpl8787\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_492e45e1fab3.png\" alt=\"pl8787\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpl8787\">庞亮\u003C\u002Fa> ​\n        \u003Cp>核心开发者\u003Cbr>\n        中科院计算所 助理教授\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flixinsu\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_200e6129a7dc.png\" alt=\"lixinsu\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flixinsu\">苏立新\u003C\u002Fa>\n        \u003Cp>开发者\u003Cbr>\n        中科院计算所 博士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr align=\"center\">\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChrisRBXiong\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_d83e406ffceb.png\" alt=\"ChrisRBXiong\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FChrisRBXiong\">熊瑞斌\u003C\u002Fa> ​\n        \u003Cp>开发者\u003Cbr>\n        中科院计算所 硕士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdyuyang\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_a8364648843c.png\" alt=\"dyuyang\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdyuyang\">丁宇阳\u003C\u002Fa> ​\n        \u003Cp>开发者\u003Cbr>\n        中科院计算所 硕士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Frgtjf\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_02624e8e77b9.png\" alt=\"rgtjf\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Frgtjf\">田俊峰\u003C\u002Fa> ​\n        \u003Cp>开发者\u003Cbr>\n        华东师范大学 硕士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n      \u003Ctd>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fwqh17101\">\u003Cimg width=\"40\" height=\"40\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_readme_5f9cf02eefb0.png\" alt=\"wqh17101\">\u003C\u002Fa>\u003Cbr>\n        ​ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fwqh17101\">王清华\u003C\u002Fa> ​\n        \u003Cp>文档维护\u003Cbr>\n        山东大学 学士\u003C\u002Fp>​\n      \u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\n\n\n## 贡献\n\n在提交 Pull Request 之前，请务必阅读 [贡献指南](.\u002FCONTRIBUTING.md)。如果你有与 MatchZoo 相关的论文\u002F项目\u002F组件\u002F工具，请向 [这个 awesome 列表](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002Fawaresome-neural-models-for-semantic-match) 提交 Pull Request！\n\n感谢所有已经为 MatchZoo 做出贡献的人！\n\n[王博](https:\u002F\u002Fgithub.com\u002Fbwanglzu), [王泽毅](https:\u002F\u002Fgithub.com\u002Fuduse), [杨柳](https:\u002F\u002Fgithub.com\u002Fyangliuy), [王梓臻](https:\u002F\u002Fgithub.com\u002FZizhenWang), [杨洲](https:\u002F\u002Fgithub.com\u002Fzhouzhouyang520), [侯建鹏](https:\u002F\u002Fgithub.com\u002FHouJP), [陈丽娟](https:\u002F\u002Fgithub.com\u002Fgithubclj), [郑玉坤](https:\u002F\u002Fgithub.com\u002Fzhengyk11), [程牛国](https:\u002F\u002Fgithub.com\u002Fniuox), [朱云岱](https:\u002F\u002Fgithub.com\u002FAdeDZY), [Aneesh Joshi](https:\u002F\u002Fgithub.com\u002Faneesh-joshi), [Zeno Gantner](https:\u002F\u002Fgithub.com\u002Fzenogantner), [黄凯](https:\u002F\u002Fgithub.com\u002Fhkvision), [stanpcf](https:\u002F\u002Fgithub.com\u002Fstanpcf), [常庆峰](https:\u002F\u002Fgithub.com\u002FChangQF), [Mike Kellogg](https:\u002F\u002Fgithub.com\u002Fwordreference)\n\n\n\n\n## 项目组织者\n\n- 郭嘉丰\n  * 中国科学院计算技术研究所\n  * [个人主页](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~gjf\u002F)\n- 兰艳艳\n  * 中国科学院计算技术研究所\n  * [个人主页](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~lanyanyan\u002F)\n- 程学旗\n  * 中国科学院计算技术研究所\n  * [个人主页](http:\u002F\u002Fwww.bigdatalab.ac.cn\u002F~cxq\u002F)\n\n\n## 许可证\n\n[Apache-2.0](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n\n版权所有 (c) 2019 至今，樊毅星 (faneshion)","# MatchZoo-py 快速上手指南\n\n## 环境准备\n\n- **操作系统**：Linux \u002F macOS \u002F Windows（推荐 Linux 或 macOS）\n- **Python 版本**：3.6 或 3.7\n- **核心依赖**：\n  - [PyTorch](https:\u002F\u002Fpytorch.org)（建议使用国内镜像加速安装）\n  - 其他依赖项将随 MatchZoo-py 自动安装\n\n> 💡 **国内用户建议**：安装 PyTorch 时可使用清华源或阿里云镜像加速，例如：\n> ```bash\n> pip install torch -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 安装步骤\n\n### 方法一：从 PyPI 安装（推荐）\n\n```bash\npip install matchzoo-py\n```\n\n### 方法二：从 GitHub 源码安装（获取最新特性）\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py.git\ncd MatchZoo-py\npython setup.py install\n```\n\n> 🌐 **国内用户提示**：若 GitHub 克隆较慢，可尝试使用代理或替换为 Gitee 镜像（如有）。\n\n## 基本使用\n\n以下示例展示如何用 MatchZoo-py 快速训练一个基于 ArcI 的排序模型（使用 WikiQA 数据集）：\n\n```python\nimport torch\nimport matchzoo as mz\n\n# 1. 定义任务（排序任务 + 自定义损失与评估指标）\nranking_task = mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=4))\nranking_task.metrics = [\n    mz.metrics.NormalizedDiscountedCumulativeGain(k=3),\n    mz.metrics.MeanAveragePrecision()\n]\n\n# 2. 加载数据\ntrain_pack = mz.datasets.wiki_qa.load_data('train', task=ranking_task)\nvalid_pack = mz.datasets.wiki_qa.load_data('dev', task=ranking_task)\n\n# 3. 数据预处理\npreprocessor = mz.models.ArcI.get_default_preprocessor()\ntrain_processed = preprocessor.fit_transform(train_pack)\nvalid_processed = preprocessor.transform(valid_pack)\n\n# 4. 构建数据集（支持 pair-wise 训练）\ntrainset = mz.dataloader.Dataset(\n    data_pack=train_processed,\n    mode='pair',\n    num_dup=1,\n    num_neg=4,\n    batch_size=32\n)\nvalidset = mz.dataloader.Dataset(\n    data_pack=valid_processed,\n    mode='point',\n    batch_size=32\n)\n\n# 5. 设置 padding 回调并创建 DataLoader\npadding_callback = mz.models.ArcI.get_default_padding_callback()\ntrainloader = mz.dataloader.DataLoader(dataset=trainset, stage='train', callback=padding_callback)\nvalidloader = mz.dataloader.DataLoader(dataset=validset, stage='dev', callback=padding_callback)\n\n# 6. 初始化并构建模型\nmodel = mz.models.ArcI()\nmodel.params['task'] = ranking_task\nmodel.params['embedding_output_dim'] = 100\nmodel.params['embedding_input_dim'] = preprocessor.context['embedding_input_dim']\nmodel.guess_and_fill_missing_params()\nmodel.build()\n\n# 7. 启动训练\noptimizer = torch.optim.Adam(model.parameters())\ntrainer = mz.trainers.Trainer(\n    model=model,\n    optimizer=optimizer,\n    trainloader=trainloader,\n    validloader=validloader,\n    epochs=10\n)\ntrainer.run()\n```\n\n> ✅ 此示例可在约 1 分钟内完成端到端流程，适合快速验证环境与基础功能。  \n> 更多模型（如 BERT、ESIM、DSSM 等）和高级用法请参考 [官方教程](https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Ftree\u002Fmaster\u002Ftutorials)。","某电商公司搜索团队正在优化商品搜索的相关性排序模型，需要快速实验多种深度语义匹配算法（如DSSM、DRMM等）来判断用户查询与商品标题的匹配程度。\n\n### 没有 MatchZoo-py 时\n- 每实现一个新模型都要从零搭建数据预处理流程，包括分词、词向量映射、负采样等，重复工作量大。\n- 不同模型的输入格式和训练逻辑不统一，难以横向对比性能，实验结果不可复现。\n- 缺乏标准化的评估指标（如NDCG、MAP），需手动编写评测代码，容易出错。\n- 超参数调优依赖人工试错，效率低下，难以系统化探索最优配置。\n- 团队成员之间模型代码风格差异大，协作困难，模型难以共享和复用。\n\n### 使用 MatchZoo-py 后\n- 内置统一的数据处理管道（DataPack + DataLoader），自动完成文本对的标准化预处理，节省70%数据准备时间。\n- 提供十余种经典深度匹配模型的一键调用接口，只需几行代码即可切换模型进行公平对比。\n- 集成Ranking\u002FClassification任务专用的损失函数与评估指标，开箱即用，确保评测一致性。\n- 支持自动化超参搜索（如通过Ray或Optuna集成），显著提升调优效率。\n- 模型结构与训练流程高度模块化，便于团队共享配置文件和复现实验结果。\n\nMatchZoo-py 将深度文本匹配从“手工作坊”升级为“标准化流水线”，让算法工程师聚焦于创新而非重复造轮子。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNTMC-Community_MatchZoo-py_0df28273.png","NTMC-Community","Neural Text Matching Community","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FNTMC-Community_0b176f66.png","",null,"matchzoocommunity@gmail.com","https:\u002F\u002Fntmc-community.github.io\u002F","https:\u002F\u002Fgithub.com\u002FNTMC-Community",[84,88],{"name":85,"color":86,"percentage":87},"Python","#3572A5",99.6,{"name":89,"color":90,"percentage":91},"Makefile","#427819",0.4,501,107,"2026-02-26T08:34:59","Apache-2.0","Linux, macOS, Windows","未说明",{"notes":99,"python":100,"dependencies":101},"项目基于 PyTorch 实现，可通过 pip 或源码安装；支持多种深度文本匹配模型，如 BERT、ESIM、DSSM 等；数据预处理和训练流程高度模块化。","3.6 | 3.7",[102],"torch",[26,55,13,14,52],[105,106,107,108,109,110,111],"text","matching","deep-learning","text-matching","neural-network","natural-language-processing","pytorch",8,"2026-03-27T02:49:30.150509","2026-04-06T05:36:26.368641",[116,121,126,131,136,141],{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},361,"如何使用 GPU 运行 MatchZoo-py 的训练器（Trainer）？","在 MatchZoo-py v1.1.1 及以上版本中，GPU 支持已修复。确保将 device 设置为 torch.device('cuda')，并确认使用的教程代码与当前版本兼容。注意部分旧教程（如 DRMM）尚未更新，建议参考已更新的教程如 DRMMTKS：https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fblob\u002Fmaster\u002Ftutorials\u002Franking\u002Fdrmmtks.ipynb。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F99",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},362,"运行 DRMM 或 BERT 示例时出现 TypeError: __init__() got an unexpected keyword argument 'batch_size' 怎么办？","从 MatchZoo-py v1.1 开始，batch_size 参数已从 DataLoader 移至 Dataset。请不要在 DataLoader 中传入 batch_size，而是将其设置在 Dataset 构造时。可参考更新后的教程，例如 ESIM 示例：https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fblob\u002Fupdate_tutorials\u002Ftutorials\u002Franking\u002Fesim.ipynb。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F142",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},363,"加载 GloVe 词向量时遇到 UnicodeDecodeError: 'charmap' codec can't decode byte ... 如何解决？","该错误通常由文件编码问题引起。可以在调用 load_glove_embedding 时手动指定 encoding='utf-8'。例如：mz.datasets.embeddings.load_glove_embedding(dimension=300, encoding='utf-8')。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F79",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},364,"训练时出现 RuntimeError: The size of tensor a (68) must match the size of tensor b (67) 怎么办？","此错误通常是因为损失函数（如 RankCrossEntropyLoss 或 RankHingeLoss）中的 num_neg 参数与数据集构造时使用的负采样数量不一致。请确保在定义任务和构建数据集时，num_neg 参数保持一致，并完整执行教程中的所有代码块。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F58",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},365,"DataLoader 加载数据非常慢，导致 GPU 利用率为 0%，如何优化？","当前 DataLoader 对每个样本单独调用 Datapack 的 __getitem__ 方法，效率低下。建议禁用 PyTorch 的自动批处理（automatic batching），改由 Dataset 直接提供整批数据。可参考 PyTorch 官方文档关于 disable-automatic-batching 的说明，使用 DataGenerator 预先批处理数据，再交由 DataLoader 加速传输到 GPU。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F109",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},366,"运行 README 中的示例代码时报 TypeError，如何解决？","该问题可能源于预处理器（preprocessor）在处理 text_right 时出错，常见于数据格式或版本不兼容。建议使用最新版 MatchZoo-py（v1.1+），并确保输入数据格式正确（如 DataFrame 包含 text_left 和 text_right 列）。若仍报错，可尝试使用已验证的教程代码替代 README 示例。","https:\u002F\u002Fgithub.com\u002FNTMC-Community\u002FMatchZoo-py\u002Fissues\u002F106",[147,152,157],{"id":148,"version":149,"summary_zh":150,"released_at":151},100029,"v1.1.1","- Optimize Dataset and DataLoader\r\n- Sort vocabulary for reproducibility when setting seed","2019-12-12T02:48:26",{"id":153,"version":154,"summary_zh":155,"released_at":156},100030,"v1.1","- Add new models: MVLSTM, MatchPyramid, HBMP, DUET, MatchSRNN, aNMM and DIIN\r\n- Add activation to classification models\r\n- Add Ngram callbacks for `Dataset`\r\n- Remove `DSSMPreprocessor`, `CDSSMPreprocessor` and `CDSSMPadding`\r\n- Add BERT `attention_mask` and `token_type_ids`\r\n- Support specifying GPUs for DataParallel and remove parameter `data_parallel` in `trainer`\r\n- Fix other bugs","2019-10-28T03:14:10",{"id":158,"version":159,"summary_zh":160,"released_at":161},100031,"v1.0","- Written based on PyTorch\r\n- Add BertPreprocessor, BertPadding, BertModule and Bert model\r\n- Speed up loading embedding & support word2vec, GloVe and fastText\r\n- Implement a majority of matching models\r\n- Support dynamic padding\r\n- Auto check task when defining a task\r\n- Support multiprocess DataLoader\r\n- Support early stopping, clipping gradient norm, validation interval and auto save best model","2019-08-22T01:57:27"]