token-and-qa
Use Simple Transformers NER/token-classification and extractive question-answering APIs, schemas, validators, and troubleshooting routes.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- token-and-qa
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Simple Transformers NER/token-classification and extractive question-answering APIs, schemas, validators, and troubleshooting routes.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md2.6 KB
- 参考文档references/data-formats.md2.5 KB
- 参考文档references/troubleshooting.md1.7 KB
- 参考文档references/workflows.md2.4 KB
- 脚本scripts/validate_token_qa_data.py5.1 KB
03 SKILL.md 正文
Simple Transformers Token and QA Sub-skill
Use this sub-skill when a task asks for named entity recognition, token
classification, CoNLL data, LayoutLM token boxes, SQuAD-style extractive QA,
answer-span validation, or QA lazy loading with simpletransformers.ner or
simpletransformers.question_answering.
Owns
NERModel/NERArgstrain, eval, and predict workflows.- NER DataFrame and CoNLL data preparation.
- NER prediction on raw strings or manually tokenized lists.
- LayoutLM token-level bounding-box schemas.
QuestionAnsweringModel/QuestionAnsweringArgstrain, eval, and predict workflows.- SQuAD-style list/JSON/JSONL QA records, impossible questions, and answer-span checks.
Route elsewhere
- Discriminative document/sentence classification: classification.
- T5/generative question answering or question generation: generative-workflows.
- Dense retrieval before QA or passage indexing: retrieval-representation.
- Shared install, CUDA policy, output/cache, and model-arg conventions: root references.
Read first
- API reference for constructors, common methods, and return shapes.
- Data formats before creating NER or QA inputs.
- Workflows for CPU-safe train/eval/predict recipes.
- Troubleshooting for answer spans, CoNLL formatting, lazy JSONL, token splitting, model downloads, and dependency compatibility.
Validation helper
Run the bundled validator before invoking model code:
python scripts/validate_token_qa_data.py --task ner-csv --input ner.csv
python scripts/validate_token_qa_data.py --task ner-conll --input train.conll
python scripts/validate_token_qa_data.py --task qa-json --input train.json
python scripts/validate_token_qa_data.py --task qa-jsonl --input train.jsonl
python scripts/validate_token_qa_data.py --task qa-predict-json --input predict.json
The helper performs deterministic schema and answer-span checks. It does not import Simple Transformers, download checkpoints, or train models.
Safe defaults
- Pass
use_cuda=Falsefor CPU smoke tests. - Set
no_save=True,overwrite_output_dir=True, andreprocess_input_data=Truefor temporary checks. - Keep NER sentence ids stable and contiguous enough for debugging, but uniqueness is more important than zero-based numbering.
- For QA, every training answer text must be a substring of
contextandanswer_startmust point to that exact substring.
Verification status
The NER and QA public constructors were inspected for Simple Transformers 0.70.8. Repo-native tests contain useful tiny data but train/download Hugging Face models, so they are treated as optional final native cases unless network/cache/compute budget is approved.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).