[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-google-research--bleurt":3,"tool-google-research--bleurt":65},[4,17,27,35,48,57],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"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 真正成长为懂上",156033,2,"2026-04-14T23:32:00",[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},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,3,"2026-04-06T11:19:32",[15,26,14,13],"图像",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":10,"last_commit_at":33,"category_tags":34,"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,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":10,"last_commit_at":41,"category_tags":42,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",85092,"2026-04-10T11:13:16",[26,43,44,45,14,46,15,13,47],"数据工具","视频","插件","其他","音频",{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":54,"last_commit_at":55,"category_tags":56,"status":16},5784,"funNLP","fighting41love\u002FfunNLP","funNLP 是一个专为中文自然语言处理（NLP）打造的超级资源库，被誉为\"NLP 民工的乐园”。它并非单一的软件工具，而是一个汇集了海量开源项目、数据集、预训练模型和实用代码的综合性平台。\n\n面对中文 NLP 领域资源分散、入门门槛高以及特定场景数据匮乏的痛点，funNLP 提供了“一站式”解决方案。这里不仅涵盖了分词、命名实体识别、情感分析、文本摘要等基础任务的标准工具，还独特地收录了丰富的垂直领域资源，如法律、医疗、金融行业的专用词库与数据集，甚至包含古诗词生成、歌词创作等趣味应用。其核心亮点在于极高的全面性与实用性，从基础的字典词典到前沿的 BERT、GPT-2 模型代码，再到高质量的标注数据和竞赛方案，应有尽有。\n\n无论是刚刚踏入 NLP 领域的学生、需要快速验证想法的算法工程师，还是从事人工智能研究的学者，都能在这里找到急需的“武器弹药”。对于开发者而言，它能大幅减少寻找数据和复现模型的时间；对于研究者，它提供了丰富的基准测试资源和前沿技术参考。funNLP 以开放共享的精神，极大地降低了中文自然语言处理的开发与研究成本，是中文 AI 社区不可或缺的宝藏仓库。",79857,1,"2026-04-08T20:11:31",[15,43,46],{"id":58,"name":59,"github_repo":60,"description_zh":61,"stars":62,"difficulty_score":54,"last_commit_at":63,"category_tags":64,"status":16},5773,"cs-video-courses","Developer-Y\u002Fcs-video-courses","cs-video-courses 是一个精心整理的计算机科学视频课程清单，旨在为自学者提供系统化的学习路径。它汇集了全球知名高校（如加州大学伯克利分校、新南威尔士大学等）的完整课程录像，涵盖从编程基础、数据结构与算法，到操作系统、分布式系统、数据库等核心领域，并深入延伸至人工智能、机器学习、量子计算及区块链等前沿方向。\n\n面对网络上零散且质量参差不齐的教学资源，cs-video-courses 解决了学习者难以找到成体系、高难度大学级别课程的痛点。该项目严格筛选内容，仅收录真正的大学层级课程，排除了碎片化的简短教程或商业广告，确保用户能接触到严谨的学术内容。\n\n这份清单特别适合希望夯实计算机基础的开发者、需要补充特定领域知识的研究人员，以及渴望像在校生一样系统学习计算机科学的自学者。其独特的技术亮点在于分类极其详尽，不仅包含传统的软件工程与网络安全，还细分了生成式 AI、大语言模型、计算生物学等新兴学科，并直接链接至官方视频播放列表，让用户能一站式获取高质量的教育资源，免费享受世界顶尖大学的课堂体验。",79792,"2026-04-08T22:03:59",[46,26,43,13],{"id":66,"github_repo":67,"name":68,"description_en":69,"description_zh":70,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":80,"owner_email":80,"owner_twitter":80,"owner_website":81,"owner_url":82,"languages":83,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":23,"env_os":92,"env_gpu":93,"env_ram":94,"env_deps":95,"category_tags":101,"github_topics":80,"view_count":10,"oss_zip_url":80,"oss_zip_packed_at":80,"status":16,"created_at":102,"updated_at":103,"faqs":104,"releases":134},7603,"google-research\u002Fbleurt","bleurt","BLEURT is a metric for Natural Language Generation based on transfer learning.","BLEURT 是一款基于迁移学习的自然语言生成评估指标，旨在更精准地衡量机器生成文本的质量。在翻译、摘要或对话系统等场景中，传统的评估方法往往难以兼顾语言的流畅度与语义的准确性。BLEURT 通过接收“参考句子”和“候选句子”作为输入，输出一个量化评分，直观反映候选句在多大程度上既通顺又完整传达了原意。\n\n与早期的 BLEU 等规则型指标不同，BLEURT 的核心优势在于它是一个经过大规模人类评分数据训练的回归模型。它依托于强大的 BERT 和 RemBERT 架构，能够深入理解上下文语义，从而提供比传统方法更接近人类判断的评估结果。此外，最新版本的 BLEURT-20 还增强了多语言能力，使其适用于更广泛的国际化场景。\n\n这款工具特别适合从事自然语言处理（NLP）的研究人员、算法工程师以及需要评估生成模型效果的开发者使用。无论是用于学术论文中的实验对比，还是工业界模型迭代时的自动化测试，BLEURT 都提供了灵活的命令行接口和 Python API，支持用户直接调用预训练模型或针对特定领域进行微调。如果你正在寻找一种可靠且高效的文本生成评估方案，BLEURT 值得纳入你的技术栈。","# BLEURT: a Transfer Learning-Based Metric for Natural Language Generation\n\nBLEURT is an evaluation metric for Natural Language Generation. It takes a pair of sentences as input, a *reference* and a *candidate*, and it returns a score that indicates to what extent the candidate is fluent and conveys the meaning of the reference. It is comparable to [`sentence-BLEU`](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBLEU), [`BERTscore`](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.09675), and [`COMET`](https:\u002F\u002Fgithub.com\u002FUnbabel\u002FCOMET).\n\nBLEURT is a *trained metric*, that is, it is a regression model trained on ratings data. The model is based on [`BERT`](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.04805) and [`RemBERT`](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2010.12821.pdf). This repository contains all the code necessary to use it and\u002For fine-tune it for your own applications. BLEURT uses Tensorflow, and it benefits greatly from modern GPUs (it runs on CPU too).\n\nAn overview of BLEURT can be found in our our [blog post](https:\u002F\u002Fai.googleblog.com\u002F2020\u002F05\u002Fevaluating-natural-language-generation.html). Further details are provided in the ACL paper [BLEURT: Learning Robust Metrics for Text Generation](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.04696) and [our EMNLP paper](http:\u002F\u002Farxiv.org\u002Fabs\u002F2110.06341).\n\n\n## Installation\n\nBLEURT runs in Python 3. It relies heavily on `Tensorflow` (>=1.15) and the\nlibrary `tf-slim` (>=1.1).\nYou may install it as follows:\n\n```\npip install --upgrade pip  # ensures that pip is current\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt.git\ncd bleurt\npip install .\n```\n\nYou may check your install with unit tests:\n\n```\npython -m unittest bleurt.score_test\npython -m unittest bleurt.score_not_eager_test\npython -m unittest bleurt.finetune_test\npython -m unittest bleurt.score_files_test\n```\n\n## Using BLEURT - TL;DR Version\n\nThe following commands download the recommended checkpoint and run BLEURT:\n\n```\n# Downloads the BLEURT-base checkpoint.\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip .\nunzip BLEURT-20.zip\n\n# Runs the scoring.\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=BLEURT-20\n```\nThe files `bleurt\u002Ftest_data\u002Fcandidates` and `references` contain test sentences,\nincluded by default in the BLEURT distribution. The input format is one sentence per line.\nYou may replace them with your own files. The command outputs one score per sentence pair.\n\n**Oct 8th 2021 Update:** we upgraded the recommended checkpoint to BLEURT-20, a more accurate, multilingual model  🎉.\n\n\n## Using BLEURT - the Long Version\n\n### Command-line tools and APIs\n\nCurrently, there are three methods to invoke BLEURT: the command-line interface, the Python API, and the Tensorflow API.\n\n#### Command-line interface\n\nThe simplest way to use BLEURT is through command line, as shown below.\n\n```\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=bleurt\u002Ftest_checkpoint \\\n  -scores_file=scores\n```\nThe files `candidates` and `references` contain one sentence per line (see the folder `test_data` for the exact format). Invoking the command should produce a file `scores` which contains one BLEURT score per sentence pair. Alternatively you may use a [JSONL file](https:\u002F\u002Fjsonlines.org\u002F), as follows:\n\n```\npython -m bleurt.score_files \\\n  -sentence_pairs_file=bleurt\u002Ftest_data\u002Fsentence_pairs.jsonl \\\n  -bleurt_checkpoint=bleurt\u002Ftest_checkpoint\n```\n\n\nThe flags `bleurt_checkpoint` and `scores_file` are optional. If `bleurt_checkpoint` is not specified, BLEURT will default to a test checkpoint, based on [BERT-Tiny](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbert), which is very light but also very inaccurate (we recommend against using it). If `scores_files` is not specified, BLEURT will use the standard output.\n\n\nThe following command lists all the other command-line options:\n\n```\npython -m bleurt.score_files -helpshort\n```\n\n\n#### Python API\n\nBLEURT may be used as a Python library as follows:\n\n```\nfrom bleurt import score\n\ncheckpoint = \"bleurt\u002Ftest_checkpoint\"\nreferences = [\"This is a test.\"]\ncandidates = [\"This is the test.\"]\n\nscorer = score.BleurtScorer(checkpoint)\nscores = scorer.score(references=references, candidates=candidates)\nassert isinstance(scores, list) and len(scores) == 1\nprint(scores)\n```\nHere again, BLEURT will default to `BERT-Tiny` if no checkpoint is specified.\n\nBLEURT works both in `eager_mode` (default in TF 2.0) and in a `tf.Session` (TF 1.0), but the latter mode is slower and may be deprecated in the near\nfuture.\n\n\n#### Tensorflow API\n\nBLEURT may be embedded in a TF computation graph, e.g., to visualize it\non the Tensorboard while training a model.\n\nThe following piece of code shows an example:\n\n```\nimport tensorflow as tf\n# Set tf.enable_eager_execution() if using TF 1.x.\n\nfrom bleurt import score\n\nreferences = tf.constant([\"This is a test.\"])\ncandidates = tf.constant([\"This is the test.\"])\n\nbleurt_ops = score.create_bleurt_ops()\nbleurt_out = bleurt_ops(references=references, candidates=candidates)\n\nassert bleurt_out[\"predictions\"].shape == (1,)\nprint(bleurt_out[\"predictions\"])\n```\nThe crucial part is the call to `score.create_bleurt_ops`, which creates the TF ops.\n\n\n## Checkpoints\n\nA *BLEURT checkpoint* is a self-contained folder that contains a regression model and some information that BLEURT needs to run. BLEURT checkpoints can be downloaded, copy-pasted, and stored anywhere. Furthermore, checkpoints are tunable, which means that they can be fine-tuned on custom ratings data.\n\n\nBLEURT defaults to the `test` checkpoint, which is very inaccaurate. We recommend\nusing [`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip) for results reporting. You may use it as follows:\n\n```\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip .\nunzip BLEURT-20.zip\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=BLEURT-20\n```\n\nThe [checkpoints page](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md) provides more information about\nhow these checkpoints were trained, as well as pointers to smaller models. Additionally, you can fine-tune BERT or existing BLEURT checkpoints on your own ratings data. The [checkpoints page](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md) describes how to do so.\n\n## Interpreting BLEURT Scores\nDifferent BLEURT checkpoints yield different scores. The currently recommended checkpoint [`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip)\ngenerates scores which are roughly between 0 and 1 (sometimes less than 0, sometimes more than 1), where 0 indicates a random output and 1 a perfect one. As with all automatic metrics, BLEURT scores are noisy. For a robust evaluation of a system's quality, we recommend averaging BLEURT scores across the sentences in a corpus. See the [WMT Metrics Shared Task](http:\u002F\u002Fstatmt.org\u002Fwmt21\u002Fmetrics-task.html) for a comparison of metrics on this aspect.\n\n\nIn principle, BLEURT should measure *adequacy*: most of its training data was collected by the WMT organizers who asked to annotators \"How much do you agree that the system output adequately expresses the meaning of the reference?\" ([WMT Metrics'18](http:\u002F\u002Fwww.statmt.org\u002Fwmt18\u002Fpdf\u002FWMT078.pdf), [Graham et al., 2015](https:\u002F\u002Fminerva-access.unimelb.edu.au\u002Fbitstream\u002Fhandle\u002F11343\u002F56463\u002FGraham_Can-machine-translation.pdf)). In practice however, the answers tend to be very correlated with *fluency* (\"Is the text fluent English?\"), and we added synthetic noise in the training set which makes the distinction between adequacy and fluency somewhat fuzzy.\n\n\n## Language Coverage\n\nCurrently, [`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip) was tested on 13 languages: Chinese, Czech, English, French, German, Japanese, Korean, Polish, Portugese, Russian, Spanish, Tamil, Vietnamese (these are languages for which we have held-out ratings data). In theory, it should work for [the 100+ languages of multilingual C4](https:\u002F\u002Fwww.tensorflow.org\u002Fdatasets\u002Fcatalog\u002Fc4#c4multilingual), on which [RemBERT](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2010.12821.pdf) was trained.\n\nIf you tried any other language and would like to share your experience, either positive or negative, please send us feedback!\n\n## Speeding Up BLEURT\n\nWe describe three methods to speed up BLEURT, and how to combine them.\n\n#### Batch size tuning\nYou may specify the flag `-bleurt_batch_size` which determines the number of sentence pairs processed at once by BLEURT. The default value is 16, you may want to increase or decrease it based on the memory available and the presence of a GPU (we typically use 16 when using a laptop without a GPU, 100 on a workstation with a GPU).\n\n\n#### Length-based batching\nLength-based batching is an optimization which consists in batching examples that have a similar a length and cropping the resulting tensor, to avoid wasting computations on padding tokens. This technique oftentimes results in spectacular speed-ups (typically, ~2-10X). It is described [here](https:\u002F\u002Ftowardsdatascience.com\u002Fdivide-hugging-face-transformers-training-time-by-2-or-more-21bf7129db9q-21bf7129db9e), and it was successfully used by [BERTScore](https:\u002F\u002Fgithub.com\u002FTiiiger\u002Fbert_score) in the field of learned metrics.\n\nYou can enable length-based by specifying `-batch_same_length=True` when calling `score_files` with the command line, or by instantiating a `LengthBatchingBleurtScorer` instead of `BleurtScorer` when using the Python API.\n\n\n#### Distilled models\nWe provide pointers to several compressed checkpoints on the [checkpoints page](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md). These models were obtained by distillation, a *lossy* process, and therefore the outputs cannot be directly compared to those of the original BLEURT model (though they should be strongly correlated).\n\n\n#### Putting everything together\nThe following command illustrates how to combine these three techniques, speeding up BLEURT by an order of magnitude (up to 20X with our configuration) on larger files:\n\n```\n# Downloads the 12-layer distilled model, which is ~3.5X smaller.\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20-D12.zip .\nunzip BLEURT-20-D12.zip\n\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_batch_size=100 \\            # Optimization 1.\n  -batch_same_length=True \\           # Optimization 2.\n  -bleurt_checkpoint=BLEURT-20-D12    # Optimization 3.\n```\n\n\n## Reproducibility\n\nYou may find information about how to work with ratings from the [WMT Metrics Shared Task](http:\u002F\u002Fwww.statmt.org\u002Fwmt19\u002Fmetrics-task.html), reproduce results\nfrom [our ACL paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.04696), and a selection of models from [our EMNLP paper](http:\u002F\u002Farxiv.org\u002Fabs\u002F2110.06341) on [this page](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fwmt_experiments.md).\n\n\n## How to Cite\n\nPlease cite our ACL paper:\n\n```\n@inproceedings{sellam2020bleurt,\n  title = {BLEURT: Learning Robust Metrics for Text Generation},\n  author = {Thibault Sellam and Dipanjan Das and Ankur P Parikh},\n  year = {2020},\n  booktitle = {Proceedings of ACL}\n}\n```\n\nThe latest model, BLEURT-20, is based on work that led to this follow-up paper:\n```\n@inproceedings{pu2021learning,\n  title = {Learning compact metrics for MT},\n  author = {Pu, Amy and Chung, Hyung Won and Parikh, Ankur P and Gehrmann, Sebastian and Sellam, Thibault},\n  booktitle = {Proceedings of EMNLP},\n  year = {2021}\n}\n```\n","# BLEURT：一种基于迁移学习的自然语言生成评价指标\n\nBLEURT 是一种用于自然语言生成任务的评价指标。它接受一对句子作为输入，即 *参考句* 和 *候选句*，并返回一个分数，该分数表示候选句在多大程度上流畅且准确地传达了参考句的语义。BLEURT 与 [`sentence-BLEU`](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBLEU)、[`BERTscore`](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.09675) 和 [`COMET`](https:\u002F\u002Fgithub.com\u002FUnbabel\u002FCOMET) 具有可比性。\n\nBLEURT 属于 *训练型指标*，即它是一个基于评分数据训练的回归模型。该模型基于 [`BERT`](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.04805) 和 [`RemBERT`](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2010.12821.pdf) 构建。本仓库包含了使用 BLEURT 以及针对您的特定应用对其进行微调所需的所有代码。BLEURT 使用 TensorFlow，并且在现代 GPU 上运行时性能会显著提升（当然也可以在 CPU 上运行）。\n\n有关 BLEURT 的概述，请参阅我们的 [博客文章](https:\u002F\u002Fai.googleblog.com\u002F2020\u002F05\u002Fevaluating-natural-language-generation.html)。更多详细信息则可在 ACL 论文 [BLEURT: Learning Robust Metrics for Text Generation](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.04696) 和 EMNLP 论文 [我们的 EMNLP 论文](http:\u002F\u002Farxiv.org\u002Fabs\u002F2110.06341) 中找到。\n\n## 安装\n\nBLEURT 运行在 Python 3 环境中。它高度依赖 `Tensorflow`（>=1.15）和库 `tf-slim`（>=1.1）。您可以按照以下步骤进行安装：\n\n```\npip install --upgrade pip  # 确保 pip 是最新版本\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt.git\ncd bleurt\npip install .\n```\n\n您可以通过单元测试来验证安装是否成功：\n\n```\npython -m unittest bleurt.score_test\npython -m unittest bleurt.score_not_eager_test\npython -m unittest bleurt.finetune_test\npython -m unittest bleurt.score_files_test\n```\n\n## 使用 BLEURT —— 简要版\n\n以下命令将下载推荐的检查点并运行 BLEURT：\n\n```\n# 下载 BLEURT-base 检查点。\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip .\nunzip BLEURT-20.zip\n\n# 运行评分。\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=BLEURT-20\n```\n\n文件 `bleurt\u002Ftest_data\u002Fcandidates` 和 `references` 包含测试句子，这些句子默认包含在 BLEURT 发行包中。输入格式为每行一句。您可以将其替换为您自己的文件。该命令会为每对句子输出一个分数。\n\n**2021年10月8日更新：** 我们已将推荐的检查点升级为 BLEURT-20，这是一款更准确、支持多语言的模型 🎉。\n\n## 使用 BLEURT —— 详细版\n\n### 命令行工具与 API\n\n目前，调用 BLEURT 有三种方式：命令行界面、Python API 和 TensorFlow API。\n\n#### 命令行界面\n\n使用 BLEURT 最简单的方式是通过命令行，如下所示：\n\n```\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=bleurt\u002Ftest_checkpoint \\\n  -scores_file=scores\n```\n\n文件 `candidates` 和 `references` 每行包含一句（具体格式请参见 `test_data` 文件夹）。执行该命令后应生成一个名为 `scores` 的文件，其中包含每对句子对应的 BLEURT 分数。或者，您也可以使用 [JSONL 文件](https:\u002F\u002Fjsonlines.org\u002F)，如下：\n\n```\npython -m bleurt.score_files \\\n  -sentence_pairs_file=bleurt\u002Ftest_data\u002Fsentence_pairs.jsonl \\\n  -bleurt_checkpoint=bleurt\u002Ftest_checkpoint\n```\n\n标志 `bleurt_checkpoint` 和 `scores_file` 是可选的。如果未指定 `bleurt_checkpoint`，BLEURT 将默认使用基于 [BERT-Tiny](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbert) 的测试检查点，该检查点非常轻量，但准确性也较低（我们不建议使用）。如果未指定 `scores_file`，BLEURT 将直接输出到标准输出。\n\n以下命令列出了所有其他命令行选项：\n\n```\npython -m bleurt.score_files -helpshort\n```\n\n#### Python API\n\nBLEURT 也可以作为 Python 库使用，如下：\n\n```\nfrom bleurt import score\n\ncheckpoint = \"bleurt\u002Ftest_checkpoint\"\nreferences = [\"这是一个测试。\"]\ncandidates = [\"这是测试。\"]\n\nscorer = score.BleurtScorer(checkpoint)\nscores = scorer.score(references=references, candidates=candidates)\nassert isinstance(scores, list) and len(scores) == 1\nprint(scores)\n```\n\n同样地，如果未指定检查点，BLEURT 将默认使用 `BERT-Tiny`。\n\nBLEURT 在 `eager_mode`（TF 2.0 默认模式）和 `tf.Session`（TF 1.0）下均可工作，但后者速度较慢，并且可能在不久的将来被弃用。\n\n#### TensorFlow API\n\nBLEURT 可以嵌入到 TF 计算图中，例如在训练模型时将其可视化在 TensorBoard 上。\n\n以下代码展示了示例：\n\n```\nimport tensorflow as tf\n# 如果使用 TF 1.x，请启用 tf.enable_eager_execution()。\n\nfrom bleurt import score\n\nreferences = tf.constant([\"这是一个测试。\"])\ncandidates = tf.constant([\"这是测试。\"])\n\nbleurt_ops = score.create_bleurt_ops()\nbleurt_out = bleurt_ops(references=references, candidates=candidates)\n\nassert bleurt_out[\"predictions\"].shape == (1,)\nprint(bleurt_out[\"predictions\"])\n```\n\n关键在于调用 `score.create_bleurt_ops`，它会创建相应的 TF 操作。\n\n## 检查点\n\n*BLEURT 检查点* 是一个自包含的文件夹，其中包含回归模型以及 BLEURT 运行所需的一些信息。BLEURT 检查点可以下载、复制粘贴并存储在任何位置。此外，检查点是可调优的，这意味着它们可以在自定义评分数据上进行微调。\n\nBLEURT 默认使用 `test` 检查点，其准确性较低。我们建议在结果报告中使用 [`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip)。使用方法如下：\n\n```\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip .\nunzip BLEURT-20.zip\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_checkpoint=BLEURT-20\n```\n\n[检查点页面](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md) 提供了关于这些检查点如何训练的更多信息，以及指向较小模型的链接。此外，您还可以在自己的评分数据上对 BERT 或现有的 BLEURT 检查点进行微调。[检查点页面](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md) 描述了具体的操作方法。\n\n## 解读 BLEURT 分数\n不同的 BLEURT 检查点会产生不同的分数。目前推荐使用的检查点 [`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip) 生成的分数大致介于 0 到 1 之间（有时小于 0，有时大于 1），其中 0 表示随机输出，1 表示完美输出。与所有自动评估指标一样，BLEURT 分数也存在噪声。为了稳健地评估系统的质量，我们建议对语料库中各句子的 BLEURT 分数取平均值。有关这方面的指标比较，请参阅 [WMT Metrics 共享任务](http:\u002F\u002Fstatmt.org\u002Fwmt21\u002Fmetrics-task.html)。\n\n\n原则上，BLEURT 应该衡量“恰当性”：其训练数据大多由 WMT 组织者收集，他们要求标注者回答：“你多大程度上同意系统输出充分表达了参考文本的含义？”（[WMT Metrics'18](http:\u002F\u002Fwww.statmt.org\u002Fwmt18\u002Fpdf\u002FWMT078.pdf)，[Graham 等，2015](https:\u002F\u002Fminerva-access.unimelb.edu.au\u002Fbitstream\u002Fhandle\u002F11343\u002F56463\u002FGraham_Can-machine-translation.pdf)）。然而，在实践中，这些答案往往与“流畅性”（“这段文字是否通顺自然？”）高度相关；此外，我们在训练集中加入了人为噪声，这使得“恰当性”和“流畅性”之间的区分变得有些模糊。\n\n\n## 语言覆盖范围\n目前，[`BLEURT-20`](https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip) 已在 13 种语言上进行了测试：中文、捷克语、英语、法语、德语、日语、韩语、波兰语、葡萄牙语、俄语、西班牙语、泰米尔语和越南语（这些语言均拥有独立的评分数据集）。理论上，它应该也能适用于 [多语言 C4 数据集中的 100 多种语言](https:\u002F\u002Fwww.tensorflow.org\u002Fdatasets\u002Fcatalog\u002Fc4#c4multilingual)，因为 [RemBERT](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2010.12821.pdf) 就是在该数据集上训练的。\n\n\n如果您尝试过其他语言并愿意分享您的使用体验——无论是正面还是负面——都欢迎向我们反馈！\n\n\n## 加速 BLEURT\n我们介绍三种加速 BLEURT 的方法及其组合方式。\n\n#### 批量大小调整\n您可以指定 `-bleurt_batch_size` 标志来决定 BLEURT 每次同时处理的句子对数量。默认值为 16，您可以根据可用内存以及是否有 GPU 来适当增大或减小该值（通常在没有 GPU 的笔记本电脑上使用 16，在配备 GPU 的工作站上则使用 100）。\n\n\n#### 基于长度的批处理\n基于长度的批处理是一种优化技术，它会将长度相近的样本分组，并裁剪结果张量以避免对填充标记进行不必要的计算。这种方法通常能带来显著的速度提升（一般为 2 至 10 倍）。相关说明可参见 [这里](https:\u002F\u002Ftowardsdatascience.com\u002Fdivide-hugging-face-transformers-training-time-by-2-or-more-21bf7129db9q-21bf7129db9e)，并且已被 [BERTScore](https:\u002F\u002Fgithub.com\u002FTiiiger\u002Fbert_score) 等学习型指标工具成功应用。\n\n\n您可以通过在命令行调用 `score_files` 时添加 `-batch_same_length=True` 参数，或者在使用 Python API 时实例化 `LengthBatchingBleurtScorer` 而非 `BleurtScorer`，来启用基于长度的批处理。\n\n\n#### 知识蒸馏模型\n我们在 [检查点页面](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fcheckpoints.md) 提供了多个压缩版检查点的链接。这些模型是通过知识蒸馏这一有损过程得到的，因此其输出无法与原始 BLEURT 模型的输出直接比较（尽管两者应高度相关）。\n\n\n#### 综合运用\n以下命令展示了如何结合上述三种技术，在较大文件上将 BLEURT 的速度提升一个数量级（在我们的配置下最高可达 20 倍）：\n\n```\n# 下载 12 层蒸馏模型，其体积约为原模型的 3.5 倍。\nwget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20-D12.zip .\nunzip BLEURT-20-D12.zip\n\npython -m bleurt.score_files \\\n  -candidate_file=bleurt\u002Ftest_data\u002Fcandidates \\\n  -reference_file=bleurt\u002Ftest_data\u002Freferences \\\n  -bleurt_batch_size=100 \\            # 优化措施 1。\n  -batch_same_length=True \\           # 优化措施 2。\n  -bleurt_checkpoint=BLEURT-20-D12    # 优化措施 3。\n```\n\n\n## 可复现性\n您可以在 [WMT Metrics 共享任务页面](http:\u002F\u002Fwww.statmt.org\u002Fwmt19\u002Fmetrics-task.html) 上找到有关如何使用评分数据的信息，以及如何复现 [我们 ACL 论文](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.04696) 中的结果；此外，[我们 EMNLP 论文](http:\u002F\u002Farxiv.org\u002Fabs\u002F2110.06341) 中的部分模型也可在 [此页面](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fblob\u002Fmaster\u002Fwmt_experiments.md) 上找到。\n\n\n## 引用方式\n请引用我们的 ACL 论文：\n\n```\n@inproceedings{sellam2020bleurt,\n  title = {BLEURT: Learning Robust Metrics for Text Generation},\n  author = {Thibault Sellam and Dipanjan Das and Ankur P Parikh},\n  year = {2020},\n  booktitle = {Proceedings of ACL}\n}\n```\n\n最新模型 BLEURT-20 基于以下后续论文的工作：\n\n```\n@inproceedings{pu2021learning,\n  title = {Learning compact metrics for MT},\n  author = {Pu, Amy and Chung, Hyung Won and Parikh, Ankur P and Gehrmann, Sebastian and Sellam, Thibault},\n  booktitle = {Proceedings of EMNLP},\n  year = {2021}\n}\n```","# BLEURT 快速上手指南\n\nBLEURT 是一种基于迁移学习的自然语言生成（NLG）评估指标。它接收“参考句”和“候选句”作为输入，输出一个分数来衡量候选句的流畅度及其对参考句语义的表达程度。该工具基于 BERT 和 RemBERT 模型，支持 GPU 加速。\n\n## 环境准备\n\n*   **操作系统**：Linux, macOS, Windows (推荐 Linux)\n*   **Python 版本**：Python 3.6+\n*   **核心依赖**：\n    *   `TensorFlow` >= 1.15 (推荐使用 TF 2.x，BLEURT 兼容 Eager Mode)\n    *   `tf-slim` >= 1.1\n*   **硬件建议**：虽然支持 CPU 运行，但强烈建议使用现代 **GPU** 以获得最佳性能。\n\n## 安装步骤\n\n1.  **升级 pip 并克隆仓库**：\n    ```bash\n    pip install --upgrade pip\n    git clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt.git\n    cd bleurt\n    ```\n\n2.  **安装 BLEURT 包**：\n    ```bash\n    pip install .\n    ```\n\n3.  **验证安装（可选）**：\n    运行单元测试以确保环境配置正确：\n    ```bash\n    python -m unittest bleurt.score_test\n    python -m unittest bleurt.score_not_eager_test\n    python -m unittest bleurt.finetune_test\n    python -m unittest bleurt.score_files_test\n    ```\n\n4.  **下载预训练模型**：\n    官方推荐使用 **BLEURT-20** 检查点（更准确且支持多语言）。\n    ```bash\n    wget https:\u002F\u002Fstorage.googleapis.com\u002Fbleurt-oss-21\u002FBLEURT-20.zip .\n    unzip BLEURT-20.zip\n    ```\n    > **提示**：如果下载速度慢，可尝试使用代理或寻找国内镜像源下载 `BLEURT-20.zip` 后解压到当前目录。\n\n## 基本使用\n\n### 方法一：命令行工具（推荐）\n\n这是最简单的使用方式。准备两个文本文件，每行包含一个句子：\n*   `references.txt`：参考句列表\n*   `candidates.txt`：待评估的候选句列表\n\n运行以下命令：\n\n```bash\npython -m bleurt.score_files \\\n  -candidate_file=candidates.txt \\\n  -reference_file=references.txt \\\n  -bleurt_checkpoint=BLEURT-20 \\\n  -scores_file=scores.txt\n```\n\n*   输出文件 `scores.txt` 将包含每一对句子的评分（每行一个分数）。\n*   如果不指定 `-scores_file`，结果将直接打印到标准输出。\n*   如果不指定 `-bleurt_checkpoint`，系统将默认使用一个极小但不准确的测试模型，**务必指定为 `BLEURT-20`**。\n\n### 方法二：Python API\n\n你可以在 Python 脚本中直接调用 BLEURT：\n\n```python\nfrom bleurt import score\n\n# 指定检查点路径\ncheckpoint = \"BLEURT-20\"\n\n# 准备数据 (列表形式)\nreferences = [\"这是一条参考句子。\", \"这是另一条参考。\"]\ncandidates = [\"这是一条候选句子。\", \"这是另一条候选。\"]\n\n# 初始化评分器\nscorer = score.BleurtScorer(checkpoint)\n\n# 计算得分\nscores = scorer.score(references=references, candidates=candidates)\n\nprint(scores)\n# 输出示例：[0.85, 0.92] (分数通常在 0 到 1 之间，越高越好)\n```\n\n### 分数解读\n*   **范围**：通常在 0 到 1 之间（也可能出现小于 0 或大于 1 的情况）。\n*   **含义**：0 表示随机输出，1 表示完美匹配。\n*   **建议**：由于自动指标存在噪声，建议在语料库级别对分数取平均值以评估系统整体质量。","某跨境电商团队正在开发智能客服系统，需要持续评估模型生成的回复质量，以确保其既流畅又能准确传达标准答案的含义。\n\n### 没有 bleurt 时\n- 依赖传统的 BLEU 分数，导致语义相似但措辞不同的优质回复被误判为低分，因为该指标过度关注词汇重叠。\n- 人工抽检耗时费力，面对每天数万条生成记录，无法全面覆盖，极易遗漏那些“看似通顺实则答非所问”的坏案例。\n- 缺乏细粒度的量化标准，开发人员难以判断模型迭代是真正提升了语义理解能力，还是仅仅在凑关键词。\n- 多语言场景下评估标准不统一，不同语种的回复质量难以横向对比，阻碍了全球化部署的进度。\n\n### 使用 bleurt 后\n- 利用基于迁移学习的评分机制，bleurt 能精准识别语义等价但表达多样的回复，大幅减少了因措辞差异导致的误判。\n- 实现了全量自动化评估，团队可实时监控每条生成内容与参考标准的相关性，快速定位并修复语义漂移问题。\n- 提供连续且鲁棒的分数反馈，让算法工程师能清晰看到模型在语义连贯性和流畅度上的细微提升，指导针对性优化。\n- 借助其多语言模型特性（如 BLEURT-20），统一了全球各语种客服回复的评估标尺，显著加速了国际化功能的上线验证。\n\nbleurt 将主观的文本质量评估转化为客观、可量化的语义相似度指标，极大提升了自然语言生成系统的迭代效率与可靠性。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle-research_bleurt_730fb9c1.png","google-research","Google Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fgoogle-research_c23b2adf.png","",null,"https:\u002F\u002Fresearch.google","https:\u002F\u002Fgithub.com\u002Fgoogle-research",[84],{"name":85,"color":86,"percentage":87},"Python","#3572A5",100,790,92,"2026-04-02T01:56:21","Apache-2.0","未说明","非必需，但强烈建议使用现代 GPU 以大幅提升性能；未指定具体型号、显存大小或 CUDA 版本","未说明（默认批处理大小为 16，可根据可用内存调整）",{"notes":96,"python":97,"dependencies":98},"该工具基于 TensorFlow 1.15+ 构建。默认使用不准确的 'test' 检查点，建议下载并使用 'BLEURT-20' 模型以获得准确结果。支持通过调整批处理大小、启用基于长度的批处理或使用蒸馏模型来加速推理。虽然主要基于 TF 1.x，但也支持 TF 2.0 的 eager 模式。","3.x",[99,100],"tensorflow>=1.15","tf-slim>=1.1",[15,46],"2026-03-27T02:49:30.150509","2026-04-15T08:09:34.328407",[105,110,115,120,125,130],{"id":106,"question_zh":107,"answer_zh":108,"source_url":109},34052,"为什么 BLEURT 返回的分数小于 0 或大于 1？","BLEURT 模型在训练数据上进行了重缩放，使大多数分数落在 [0, 1] 范围内，并对异常值进行了裁剪。同时生成了得分为 1 的人工正例和得分为 0 的人工负例。最新的 BLEURT 模型返回的值大部分在 0 到 1 之间，但仍可能出现超出该范围的情况，这是正常现象。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fissues\u002F1",{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},34053,"在 Jupyter Notebook 或 Google Colab 中使用 BLEURT 时遇到 'UnrecognizedFlagError: Unknown command line flag f' 错误怎么办？","这是因为 TensorFlow 在 Notebook 环境中自动添加了 '-f' 标志。解决方法是在导入依赖项后、初始化 scorer 之前，添加以下代码来定义该标志：\n\ntf.compat.v1.flags.DEFINE_string('f', '', '')\n\n这样可以避免该错误。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fissues\u002F7",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},34054,"使用 Python API 时提示找不到 'bleurt\u002Ftest_checkpoint' 或默认检查点怎么办？","默认检查点应随 BLEURT 包一起安装。如果报错找不到，请尝试显式指定检查点的绝对路径。例如，如果安装在用户主目录下，路径可能为：\n\ncheckpoint = \"\u002Fhome\u002Fuser\u002Fbleurt\u002Fcheckpoint\"\nscorer = score.BleurtScorer(checkpoint)\n\n请检查你的 BLEURT 安装目录中是否存在名为 'checkpoint' 的文件夹，其中包含 TF 预训练模型文件。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fissues\u002F8",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},34055,"运行 BLEURT 评分脚本时出现 'Expected to be a int64 tensor but is a int32' 类型错误如何解决？","这是一个已知的数据类型兼容性问题。社区用户建议参考并应用 Pull Request #44 中的修复方案。你可以尝试手动应用该 PR 中的代码更改，或者等待维护者合并修复后重新安装最新版本的 BLEURT。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fissues\u002F9",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},34056,"加载 BLEURT 检查点时 GPU 内存被占满导致崩溃怎么办？","这通常发生在较新版本的 TensorFlow (如 2.10+) 与旧版 BLEURT 模型之间。建议尝试以下方法：\n1. 限制 TensorFlow 可用的 GPU 内存增长：\n   gpus = tf.config.experimental.list_physical_devices('GPU')\n   if gpus:\n     try:\n       tf.config.experimental.set_memory_growth(gpus[0], True)\n     except RuntimeError as e:\n       print(e)\n2. 确保使用的是与当前 TensorFlow 版本兼容的 BLEURT 检查点版本。\n3. 考虑在 CPU 上运行推理，或在具有更大显存的 GPU 上运行。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fbleurt\u002Fissues\u002F54",{"id":131,"question_zh":132,"answer_zh":133,"source_url":119},34057,"如何正确初始化 BleurtScorer 以避免路径错误？","初始化 BleurtScorer 时，如果不指定 checkpoint 参数，它会尝试使用默认的 BLEURT-tiny 模型。如果默认模型未找到，会抛出 AssertionError。推荐做法是：\n1. 确认 BLEURT 已完整安装，并找到其安装目录下的 'checkpoint' 文件夹。\n2. 使用该文件夹的绝对路径进行初始化：\n   scorer = score.BleurtScorer('\u002Fabsolute\u002Fpath\u002Fto\u002Fbleurt\u002Fcheckpoint')\n3. 如果在 Notebook 中运行，记得先处理 TensorFlow 的命令行标志问题（见相关 FAQ）。",[]]