Download metadata/code/text_classification/README.md from AnonymousAuthorEE33/ParaGen-Bench: direct link, hf CLI and curl.
- Browser
- Download file 2.69 kB
-
https://huggingface.co/datasets/AnonymousAuthorEE33/ParaGen-Bench/resolve/main/metadata/code/text_classification/README.md
- Command line
-
hf download hf://datasets/AnonymousAuthorEE33/ParaGen-Bench/metadata/code/text_classification/README.md
-
curl -L -o README.md https://huggingface.co/datasets/AnonymousAuthorEE33/ParaGen-Bench/resolve/main/metadata/code/text_classification/README.md
Text classification: reassembling pool checkpoints
Each text-classification cell <arch>__<dataset> has
| file | content |
|---|---|
zoo/<dataset>/<arch>/<model_id>.pth |
base checkpoint (full model_state_dict, training config, val metric; word-level models also store the vocabulary stoi) |
ckpt/text_classification/<arch>__<dataset>/<model_id>/collect_000.pth ... collect_199.pth |
200 pool checkpoints |
metadata/configs/text_classification/<cell>/<model_id>/config.json |
base training config |
metadata/configs/text_classification/<cell>/<model_id>/collect_config.json |
collection protocol |
metadata/registry/text_classification.json |
one record per cell: base training info, collect config, per-checkpoint logs, pool statistics |
The token embedding is not in the pool files
The pool is collected by continuing training from the converged base model with a fresh AdamW (small learning rate,
collect_lr in collect_config.json) and saving one checkpoint every save_every steps. During collection the
vocabulary token-embedding matrix is frozen, so it is identical in all 200 pool members and in the base model.
It is therefore stored only once, in the base checkpoint, and left out of every pool file.
A pool file is a dict with
model_state_dict: every tensor of the model except the frozen keys (float32);frozen_keys: the omitted keys, e.g.["bert.embeddings.word_embeddings.weight"]; fort5smallthe three tied copiestransformer.shared.weight,transformer.encoder.embed_tokens.weight,transformer.decoder.embed_tokens.weight;frozen_source: the local path of the base checkpoint at collection time (on the Hub it is theckpt_pathof the registry record,zoo/<dataset>/<arch>/<model_id>.pth);collect_step,train_step,val_metric,val_loss.
The parameters a generator has to produce are generated_params in the registry record (total minus frozen_params).
Reassembling a full model
from assemble import assemble
sd = assemble("zoo/agnews/bertbase/bertbase_010.pth",
"ckpt/text_classification/bertbase__agnews/bertbase_010/collect_000.pth")
model.load_state_dict(sd, strict=True)
assemble(base_ckpt_path, pool_ckpt_path) copies each key in frozen_keys from the base's model_state_dict into the
pool model_state_dict and returns the full state_dict. The same function applies to generated weights: fill the
generated tensors, then add the frozen keys from the base checkpoint. For every cell the collection script checked that
the reassembled collect_000.pth reproduces its logged validation metric (training_info.assemble_check in the registry).