data-preparation
Use BERT-pytorch to build, load, and debug vocabularies and dataset inputs from tab-separated sentence pairs.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- data-preparation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use BERT-pytorch to build, load, and debug vocabularies and dataset inputs from tab-separated sentence pairs.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/corpus-format.md2.2 KB
- 参考文档references/troubleshooting.md1.9 KB
03 SKILL.md 正文
data-preparation
Use this sub-skill when the task is about corpus layout, vocabulary files, bert-vocab, WordVocab, BERTDataset, or pickle vocab troubleshooting.
What this covers
- Build a vocabulary from a corpus with
bert-vocabor the Python API. - Read and write
WordVocabpickle files. - Inspect
BERTDatasetinputs and outputs. - Diagnose malformed tab-separated rows, missing corpus files, and streaming-mode pitfalls.
What to do first
- If the corpus is not two sentences per line separated by one tab, fix the corpus before building a vocab.
- If you are using streaming mode, pass an explicit
corpus_linesvalue; for small jobs, preferon_memory=True. - Use
scripts/build_vocab_smoke.pywhen you want a safe tiny fixture that proves both vocab creation and dataset loading. - If the task is actually about model construction, training, or checkpoints, hand off to
../training/SKILL.md.
Read these references
references/corpus-format.md: corpus layout, special tokens, dataset fields, and the tiny smoke recipe.references/troubleshooting.md: malformed rows, pickle problems, streaming-mode issues, and tokenization mistakes.../training/SKILL.md: follow this route after you have a valid corpus and vocab.
Related scripts
scripts/build_vocab_smoke.py: build a tiny vocab, reload it, and inspect one dataset item.../../scripts/make_tiny_corpus.py: create a deterministic two-line corpus fixture for experiments.
Common outputs
WordVocabstores special tokens at fixed ids: pad 0, unk 1, eos 2, sos 3, mask 4.BERTDataset.__getitem__returnsbert_input,bert_label,segment_label, andis_nexttensors.WordVocab.load_vocab()expects a pickle created by this package, not a text vocabulary.
Boundary reminders
- Do not solve model initialization or checkpointing here.
- Do not hide corpus-format bugs behind training troubleshooting.
- Keep the route focused on data layout, vocab serialization, and dataset inspection.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.