simpletransformers
Use Simple Transformers package workflows for NLP classification, NER, QA, generation, T5, Seq2Seq, retrieval, representations, data validation, and troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- simpletransformers
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Simple Transformers package workflows for NLP classification, NER, QA, generation, T5, Seq2Seq, retrieval, representations, data validation, and troubleshooting.
- disable-model-invocation
- true
02 资源文件 8
- 参考文档references/cli-and-viewer.md1.1 KB
- 参考文档references/configuration.md2.2 KB
- 参考文档references/package-overview.md3.6 KB
- 参考文档references/repo-provenance.md1.4 KB
- 参考文档references/repo-routing-metadata.json547 B
- 参考文档references/troubleshooting.md1.9 KB
- 脚本scripts/check_simpletransformers_env.py2.3 KB
- 脚本scripts/inspect_model_args.py1.4 KB
03 SKILL.md 正文
Simple Transformers Repo Skill
Use this skill when the user asks about the simpletransformers Python package,
Simple Transformers task wrappers, task-specific training/evaluation/prediction
data formats, ClassificationModel, NERModel, QuestionAnsweringModel,
LanguageModelingModel, LanguageGenerationModel, T5Model, Seq2SeqModel,
RepresentationModel, RetrievalModel, ConvAIModel, or package-specific
import/runtime errors.
Install and import baseline
Simple Transformers wraps Hugging Face Transformers and uses PyTorch in model modules. Install a compatible PyTorch build before importing task model classes:
pip install torch # choose CPU or CUDA wheel for the target machine
pip install simpletransformers
python -c "import simpletransformers; print(simpletransformers.name)"
For smoke runs, pass use_cuda=False to model constructors unless the user has
already verified a CUDA-capable PyTorch environment.
Route by task
| User task | Read |
|---|---|
| binary/multiclass/regression/sentence-pair/multilabel/LayoutLM/multimodal classification, cross-encoder reranking | classification |
| named entity recognition, token classification, CoNLL, LayoutLM token boxes, extractive QA, SQuAD JSON/JSONL | token-and-qa |
| language model training/fine-tuning, generation, T5, Seq2Seq, ConvAI, text-to-text tasks | generative-workflows |
| sentence/word representations, dense retrieval, DPR, hard negatives, BEIR/MSMARCO/TREC, FAISS/pytrec | retrieval-representation |
Shared references
- Package overview maps public tasks to model classes and notes install/backend constraints.
- Configuration explains shared
ModelArgs/task args and safe smoke-run defaults. - CLI and viewer explains the
simple-viewerStreamlit launcher and why not to run it in automated checks. - Troubleshooting covers import/version, PyTorch, CUDA, downloads, outputs/cache, multiprocessing, and optional dependencies.
- Repository provenance records the source snapshot and refresh baseline.
Bundled helper scripts
scripts/check_simpletransformers_env.py: run to check package versions, task-module imports, and optional CUDA visibility.scripts/inspect_model_args.py: run in an environment where Simple Transformers imports cleanly to list args dataclass fields.- Sub-skill validators under
sub-skills/*/scripts/: use these before model construction to catch data/schema mistakes without downloads or training.
Compatibility warning
Simple Transformers 0.70.8 declares transformers>=4.31.0 but package
inspection found runtime hazards with modern Transformers versions: removed
SequenceSummary aliases, TransfoXLConfig, and top-level cached_path can
break imports before any dataset is read. When import errors mention these
symbols, debug dependency compatibility first and use the troubleshooting
references; do not rewrite user data prematurely.
Safe operating defaults
- Validate data with the nearest bundled validator.
- Use CPU (
use_cuda=False) and no-save settings for smoke/debug runs. - Avoid full examples/tests unless model downloads, data downloads, training time, and compute budget are approved.
- Choose explicit
output_dir,cache_dir, and checkpoint policy before production runs. - Install optional dependencies such as ONNX, FAISS, BEIR, pytrec, Streamlit server usage, or WandB only for workflows that need them.
- If the current repository/package has changed from provenance, refresh this skill before relying on exact API/version claims.
Non-goals
- Raw Hugging Face Transformers Trainer/model/tokenizer guidance when the user is not using Simple Transformers.
- Generic vector database or RAG framework workflows outside Simple Transformers retrieval APIs.
- Long-running training, benchmark execution, dataset downloads, or Streamlit server launches as default verification steps.
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).