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, or hfl/rbtl3 loading.
- Deciding between
BertTokenizer/BertModel and AutoTokenizer/AutoModel for these identifiers.
- Explaining why
RobertaTokenizer or RobertaModel is wrong for these models despite names containing RoBERTa.
- 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
BertTokenizer plus BertModel, or AutoTokenizer plus AutoModel. Do not use RobertaTokenizer or RobertaModel for this repository's Chinese RoBERTa-wwm family.
- Decide the loading mode before calling
from_pretrained:
- offline/cache validation: use
local_files_only=True or 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.
- If the goal is only to validate a model id or check local cache state, run
scripts/check_transformers_model.py instead 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.
1---2name: model-loading3description: "Load HFL Chinese BERT-wwm family models with Transformers or4 PaddleHub while avoiding RoBERTa-class and offline-cache mistakes."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/model-loading8 disco-role: operating9license: Apache 2.010---1112# model-loading1314Use 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.1516## Route here for1718- `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`, or `hfl/rbtl3` loading.19- Deciding between `BertTokenizer`/`BertModel` and `AutoTokenizer`/`AutoModel` for these identifiers.20- Explaining why `RobertaTokenizer` or `RobertaModel` is wrong for these models despite names containing `RoBERTa`.21- Distinguishing TensorFlow checkpoint zips from Hugging Face/PyTorch files.22- PaddleHub module-name lookup and optional Paddle/PaddleHub dependency caveats.23- Offline-safe model-id validation or cache checks with the bundled helper.2425## Route elsewhere2627- Fine-tuning hyperparameters, task/model selection, WWM interpretation, and benchmark-driven model choice: `../task-selection-and-finetuning/SKILL.md`.28- Dataset schemas, dataset availability, and benchmark table interpretation: `../data-and-benchmarks/SKILL.md`.29- Cross-cutting environment, cache, proxy, and framework issues that are not specific to these loading workflows: `../../references/troubleshooting.md`.3031## Operating pattern32331. Identify whether the user is using Hugging Face Transformers, PaddleHub, or a downloaded checkpoint zip.342. Normalize the requested model to a supported HFL id or PaddleHub module name using `references/loading-workflows.md`.353. For Transformers, prefer `BertTokenizer` plus `BertModel`, or `AutoTokenizer` plus `AutoModel`. Do not use `RobertaTokenizer` or `RobertaModel` for this repository's Chinese RoBERTa-wwm family.364. Decide the loading mode before calling `from_pretrained`:37 - offline/cache validation: use `local_files_only=True` or the bundled checker's default offline mode;38 - online download: make the network action explicit and ensure the user expects checkpoint downloads;39 - local checkpoint directory: verify the directory contains files matching the framework path being used.405. If the goal is only to validate a model id or check local cache state, run `scripts/check_transformers_model.py` instead of writing ad hoc loading code.4142## Bundled helper4344Run the checker from this sub-skill directory or provide its path explicitly:4546```bash47python scripts/check_transformers_model.py --help48python scripts/check_transformers_model.py hfl/rbt3 --try-load-tokenizer --offline-only49python scripts/check_transformers_model.py --model-id hfl/chinese-roberta-wwm-ext --try-load-config --allow-download50```5152The 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.5354## References5556- `references/loading-workflows.md`: model-id and PaddleHub mappings, offline/online/cache workflows, and checkpoint-format notes.57- `references/api-reference.md`: verified public APIs and signatures for the minimum Transformers workflow.58- `references/troubleshooting.md`: workflow-specific failure diagnosis and fixes.