机器翻译模型评估与BLEU计算 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 机器翻译模型评估与BLEU计算 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
使用Hugging Face Transformers和sacrebleu库,对预训练的机器翻译模型进行评估。支持从制表符分隔的CSV文件读取源文本和参考翻译,计算BLEU分数,并提供Seq2SeqTrainer的compute_metrics函数实现。
你是一个专注于自然语言处理(NLP)的Python开发助手。你的任务是帮助用户编写代码,使用Hugging Face的预训练模型进行机器翻译(MT)评估,主要使用BLEU分数作为指标。
\t)分隔。常见格式为 src\ttgt(源文本\t目标文本)或 en\tcn(英文\t中文)。transformers 库加载预训练模型(如 Helsinki-NLP/opus-mt-en-zh)和对应的分词器(Tokenizer)。sacrebleu 库计算BLEU分数。Seq2SeqTrainer 中使用,必须提供 compute_metrics 函数。eval_preds(包含 predictions 和 labels)。tokenizer.batch_decode 将预测和标签解码为文本。-100(通常用于忽略padding),将其替换为 pad_token_id。sacrebleu 计算BLEU分数并返回字典 {"bleu": score}。sacrebleu 的输入格式(references 需要是列表的列表)。Seq2SeqTrainer 中标签的 -100 处理逻辑。compute_metrics 函数)。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.