training
Train, resume, smoke-test, or troubleshoot BigGAN-PyTorch GAN runs, including BigGAN and BigGANdeep architectures, CUDA parallelism, gradient accumulation, EMA, spectral normalization, orthogonal regularization, precision modes, checkpoints, datasets, and the checked-in launch recipes.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Train, resume, smoke-test, or troubleshoot BigGAN-PyTorch GAN runs, including BigGAN and BigGANdeep architectures, CUDA parallelism, gradient accumulation, EMA, spectral normalization, orthogonal regularization, precision modes, checkpoints, datasets, and the checked-in launch recipes.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-reference.md15.1 KB
- 参考文档references/troubleshooting.md19.6 KB
- 参考文档references/workflows.md21.5 KB
03 SKILL.md 正文
BigGAN-PyTorch training
Use this sub-skill as the training router for the BigGAN-PyTorch repository. It
covers the executable training path (train.py and train_fns.py), the model
and numerical building blocks (BigGAN.py, BigGANdeep.py, layers.py,
losses.py, and sync_batchnorm/), and the bookkeeping/data helpers in
utils.py.
Route by intent
- Start a run or choose a recipe: read
references/workflows.md. - Choose flags, understand tensor/optimizer contracts, or modify a model:
read
references/api-reference.md. - Diagnose a failed help command, data path, OOM, resume, precision, or
multi-GPU run: read
references/troubleshooting.md.
Do not launch a production-scale run until the CUDA, dataset, output-root, and
experiment-name gates in workflows.md pass. The code is designed for CUDA;
train.py assigns device = 'cuda', and the sampling/standing-stat utilities
also create tensors on CUDA. A CPU-only run is not a supported fallback.
Non-negotiable facts
- The historical README targets PyTorch 1.0.1 plus
tqdm,numpy,scipy, andh5py; this is an old research codebase, so validate the installed PyTorch/torchvision pair before a long run. - Supported dataset keys are
I32,I64,I128,I256, their_hdf5ImageNet forms,C10, andC100. The key determines resolution, class count, and the child name appended belowdata_root; do not substitute an arbitrary directory name without updating the metadata dictionaries. --parallelusestorch.nn.DataParallelaround the combinedG_Dmodule, not distributed training. Select visible GPUs withCUDA_VISIBLE_DEVICES.- The default loss is hinge loss. The training closure averages each
accumulation loss before
backward(), then takes one optimizer step for the corresponding network. --emacreates a non-optimizing generator copy.--use_emaaffects sampling/metrics only when EMA is enabled; it does not change which weights are optimized. Standing-stat accumulation is a separate option.--G_fp16/--D_fp16cast the corresponding modules (and the relevant data) to half. The*_mixed_precisionswitches select the repository's naiveAdam16; they are not a modern AMP/Tensor-Core implementation. The README reports early collapse risk and no Tensor-Core activation for this path.- Checkpoints are a family of files under
<weights_root>/<experiment_name>/: G, D, both optimizer states,state_dict, and optionallyG_ema. Resume with the same configuration-derived or explicitly supplied experiment name; use--load_weightsfor suffixes such asbest0orcopy0. - On Python 3.11,
python train.py --helpcan crash before showing help withValueError: unsupported format character '#'. The literal%#.#f/%#.#etext in the--logstylehelp string is interpreted by argparse's%formatter. Escape the literal percent signs in that help string as%%#.#f/%%#.#e(or replace the text with words); keep the runtime--logstylevalue such as%3.3eunchanged. The same failure is observable on newer Python versions. This is a parser-help bug, not a CUDA diagnosis.
For a short, bounded verification run, use the temporary ImageFolder smoke
harness in workflows.md; it bypasses the repository's unconditional Inception
startup, avoids metric evaluation and checkpoint sample sheets, uses one tiny
batch, and keeps all artifacts outside the repository.
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).