技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-preparation【数据与研究】Routes OpenNMT-py corpus YAML, vocabulary building, transforms, tokenizers, source features, and data preparation failure recovery.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when an OpenNMT-py task is about shaping corpora before training or inference: corpus YAML, onmt_build_vocab, transform lists, tokenizer models, source features, alignment-aware data, and data/config validation failures.
data, path_src, path_tgt, path_txt, path_align, src_vocab, tgt_vocab, save_data, n_sample, or share_vocab.onmt_build_vocab or understand the plain-text vocab files that training later consumes.filtertoolong, prefix, suffix, clean, normalize, inferfeats, onmt_tokenize, sentencepiece, bpe, bart, switchout, tokendrop, tokenmask, or insert_mask_before_placeholder.../training/.../inference/.../conversion/.Read references/data-formats.md for the self-contained corpus YAML schema, vocabulary fields, transform ownership, tokenizer options, source-feature rules, and examples.
Run the bundled validator before launching an expensive build or training job:
python scripts/validate_data_config.py --config CONFIG.yaml --root DATA_ROOT --mode build-vocab
Use --mode train when checking that already-built vocab files exist for onmt_train; use --mode generic for a partial data-only YAML.
Build vocabularies only after the config is clean enough for the intended mode:
onmt_build_vocab -config CONFIG.yaml -n_sample 5000
If n_src_feats is greater than zero, confirm every corpus has inferfeats in transforms and that src_feats_defaults has exactly one │-separated value per source feature.
If alignment learning is involved, validate every path_align and avoid on-the-fly tokenization or token-deleting transforms in the aligned training config.
data mapping, train corpus ids, valid, file path fields, weights, source-only language-model layouts, and blockwise path_txt data.src_vocab, tgt_vocab, share_vocab, save_data, overwrite, n_sample, dump_samples, learn_subwords, and feature vocab side outputs.n_src_feats, src_feats_defaults, inferfeats, and common mixed-feature-line failures.scripts/validate_data_config.py is a self-contained validator. It parses YAML with PyYAML, checks OpenNMT-py data mappings and paths, validates vocab fields for build or train modes, checks feature defaults and sampled feature annotations, warns about transform/tokenizer pitfalls, and never imports the source checkout.
Useful invocations:
python scripts/validate_data_config.py --config CONFIG.yaml --root . --mode generic
python scripts/validate_data_config.py --config CONFIG.yaml --root . --mode build-vocab --strict
python scripts/validate_data_config.py --config CONFIG.yaml --root . --mode train --sample-lines 50
If onmt_build_vocab or onmt_train fails before model computation starts, read references/troubleshooting.md first. Most failures are config shape, relative paths, missing vocab fields, source-feature count mismatches, tokenizer model paths, or transforms that are incompatible with alignments or build-vocab mode.