AGENT SKILL

stylegan2-pytorch

Guides StyleGAN2 PyTorch image GAN training, checkpoint generation, interpolation, and programmatic sampling with the stylegan2_pytorch package.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
stylegan2-pytorch
license
MIT
metadata
{ "disco-role": "operating" }
description
Guides StyleGAN2 PyTorch image GAN training, checkpoint generation, interpolation, and programmatic sampling with the stylegan2_pytorch package.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

StyleGAN2 PyTorch Repo Skill

Use this repo skill when a task involves the stylegan2_pytorch package, the stylegan2_pytorch command, or StyleGAN2-style image GAN training/sampling in this implementation. The package is CUDA-first: importing the main module asserts that torch.cuda.is_available() is true, so do not plan CPU-only use.

Fast routing

  • Use training for command-line training from an image folder, checkpoint resume/restart decisions, sample generation, interpolation GIFs, low-data augmentation, FID/logging options, transparent images, attention/vector-quantization knobs, and multi-GPU settings.
  • Use programmatic-api when the user wants Python code with ModelLoader, Trainer, or StyleGAN2, especially loading a trained checkpoint and saving generated images from tensors.
  • Read references/troubleshooting.md when an install, import, CUDA, optional dependency, CLI parsing, checkpoint, or package-version failure blocks either workflow.
  • Read references/repo-provenance.md before deciding whether this skill is stale for a checkout or should be refreshed.

Package facts to keep in mind

  • Distribution name and import name: stylegan2_pytorch.
  • Console command: stylegan2_pytorch.
  • Public exports from the package root: Trainer, StyleGAN2, ModelLoader, and NanException.
  • The core CLI is implemented with Python Fire around train_from_folder, so Fire help displays underscore flag names even though the README commonly shows hyphenated flag names.
  • Training inputs are recursive image folders containing .jpg, .jpeg, or .png files.
  • Default outputs are results/<name>/ for generated images and models/<name>/model_<n>.pt plus models/<name>/.config.json for checkpoints and model settings.

Install and environment check

The documented public install path is:

pip install stylegan2_pytorch

For a local clone, an editable install is useful while developing or verifying against that checkout:

pip install -e .

Use a CUDA-capable PyTorch/torchvision build before relying on the package. The main module imports aim, einops, kornia, vector_quantize_pytorch, torch, torchvision, and other setup dependencies at import time.

After installing, run the bundled checker from this skill directory if the user has an environment ready:

python scripts/check_install.py

It performs only import, CUDA, signature, and CLI-help checks; it does not train or download data.

Workflow starting points

  1. For a new training run, open training, then use its data-layout and CLI references to choose --data, --name, image size, batch/accumulation, output directories, and augmentation settings.
  2. For generation after a run, keep the same --name, --models_dir, and --results_dir layout and use the training generation/interpolation routes.
  3. For Python sampling, open programmatic-api; ModelLoader expects the default base_dir/models/<name>/ checkpoint layout.
  4. If the request is about another image-generation stack such as Diffusers, ComfyUI, Stable Diffusion LoRA training, image classification, detection, or segmentation, this skill is probably not the right operating graph.

Verification status

This skill was constructed with a CUDA backend inspection environment and a post-integration plan for CLI help, one-step training, and ModelLoader sampling checks. The user requested not to import the skill into the managed repo-skill library, so use the generated directory directly unless a later request authorizes import.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351