model-loading
Load HFL Chinese BERT-wwm family models with Transformers or PaddleHub while avoiding RoBERTa-class and offline-cache mistakes.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-loading
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Load HFL Chinese BERT-wwm family models with Transformers or PaddleHub while avoiding RoBERTa-class and offline-cache mistakes.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md6.9 KB
- 参考文档references/loading-workflows.md8.3 KB
- 参考文档references/troubleshooting.md8.2 KB
- 脚本scripts/check_transformers_model.py11.3 KB
03 SKILL.md 正文
model-loading
Use this sub-skill when a task is about loading or validating HFL Chinese BERT-wwm family model identifiers, choosing the correct MODEL_NAME or PaddleHub MODULE_NAME, checking whether a model is available in an offline Hugging Face cache, or fixing errors caused by using RoBERTa classes for RoBERTa-wwm-named checkpoints.
Route here for
hfl/chinese-bert-wwm,hfl/chinese-bert-wwm-ext,hfl/chinese-roberta-wwm-ext,hfl/chinese-roberta-wwm-ext-large,hfl/rbt3,hfl/rbt4,hfl/rbt6, orhfl/rbtl3loading.- Deciding between
BertTokenizer/BertModelandAutoTokenizer/AutoModelfor these identifiers. - Explaining why
RobertaTokenizerorRobertaModelis wrong for these models despite names containingRoBERTa. - Distinguishing TensorFlow checkpoint zips from Hugging Face/PyTorch files.
- PaddleHub module-name lookup and optional Paddle/PaddleHub dependency caveats.
- Offline-safe model-id validation or cache checks with the bundled helper.
Route elsewhere
- Fine-tuning hyperparameters, task/model selection, WWM interpretation, and benchmark-driven model choice:
../task-selection-and-finetuning/SKILL.md. - Dataset schemas, dataset availability, and benchmark table interpretation:
../data-and-benchmarks/SKILL.md. - Cross-cutting environment, cache, proxy, and framework issues that are not specific to these loading workflows:
../../references/troubleshooting.md.
Operating pattern
- Identify whether the user is using Hugging Face Transformers, PaddleHub, or a downloaded checkpoint zip.
- Normalize the requested model to a supported HFL id or PaddleHub module name using
references/loading-workflows.md. - For Transformers, prefer
BertTokenizerplusBertModel, orAutoTokenizerplusAutoModel. Do not useRobertaTokenizerorRobertaModelfor this repository's Chinese RoBERTa-wwm family. - Decide the loading mode before calling
from_pretrained:- offline/cache validation: use
local_files_only=Trueor the bundled checker's default offline mode; - online download: make the network action explicit and ensure the user expects checkpoint downloads;
- local checkpoint directory: verify the directory contains files matching the framework path being used.
- offline/cache validation: use
- If the goal is only to validate a model id or check local cache state, run
scripts/check_transformers_model.pyinstead of writing ad hoc loading code.
Bundled helper
Run the checker from this sub-skill directory or provide its path explicitly:
python scripts/check_transformers_model.py --help
python scripts/check_transformers_model.py hfl/rbt3 --try-load-tokenizer --offline-only
python scripts/check_transformers_model.py --model-id hfl/chinese-roberta-wwm-ext --try-load-config --allow-download
The helper validates the bundled model-id map and imports the expected Transformers classes. It does not download by default. It exits nonzero for unknown ids, missing imports/backends, or any requested config/tokenizer/model load that fails.
References
references/loading-workflows.md: model-id and PaddleHub mappings, offline/online/cache workflows, and checkpoint-format notes.references/api-reference.md: verified public APIs and signatures for the minimum Transformers workflow.references/troubleshooting.md: workflow-specific failure diagnosis and fixes.
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).