pytorch-migrate

A migration guide for projects built from pytorch_template, a starter template for PyTorch machine-learning projects. It detects the project’s template version and applies the required updates from the latest template.

In plain words
What is it for?
Use it when updating, upgrading, or synchronizing a PyTorch template project, especially when newer features or structural changes are missing.
Why use it?
It helps bring an older project up to date without manually identifying every missing template change. The project’s files are checked against the current template to determine what needs updating.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/axect/pytorch_template/pytorch-migrate
Any agent
npx skills add Axect/pytorch_template --skill pytorch-migrate
Clone the repo
git clone --depth 1 https://github.com/Axect/pytorch_template

Made for: Claude Code, Codex.

Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00078 $0.02286
Opus 5 $0.00039 $0.01143
Sonnet 5 $0.00016 $0.00457
Haiku 4.5 $0.00008 $0.00229

Measured 2d ago against content hash c69ad437eed4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

pytorch-migrate scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf "$TEMPLATE_DIR"
skills/pytorch-migrate/SKILL.md · 186 lines

How it starts

The opening of the file, as written. The whole thing — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pytorch-migrate

Detect the current version of a pytorch_template-based project and apply all necessary migrations to bring it up to date.

Usage

/pytorch-migrate [project_path]

If project_path is omitted, uses the current working directory.


Step 0: Clone the Template

Clone the latest template into a temporary directory. All code references during migration come from this clone — never from embedded snippets.

TEMPLATE_DIR=$(mktemp -d)
git clone --depth 1 https://github.com/Axect/pytorch_template.git "$TEMPLATE_DIR"

Use $TEMPLATE_DIR as the source of truth for all file contents throughout the migration. After migration is complete, clean up:

rm -rf "$TEMPLATE_DIR"

Step 1: Detect Current Version

Read the project's files and determine which version it's based on by checking for feature markers.

Run these checks in order — the first missing feature determines the starting migration point:

Check How to detect Version if MISSING
config.py has RunConfig dataclass class RunConfig exists Pre-template (not migratable)
callbacks.py exists File exists v0 (monolithic, pre-callback refactor)
pruner.py has PFLPruner class PFLPruner in pruner.py v1 (pre-PFL pruner, before 2024-12)
callbacks.py has OptimizerModeCallback Class exists v1 (pre-M1, missing optimizer mode toggle)
callbacks.py has LossPredictionCallback Class exists v1 (pre-M1, missing loss prediction)
callbacks.py has NaNDetectionCallback Class exists v2 (pre-NaN detection, before 2024-09)
callbacks.py has CheckpointCallback Class exists v3 (pre-checkpoint, before 2025-04)
config.py has data field in RunConfig data: str in RunConfig v4 (pre-data-decoupling)
callbacks.py has GradientMonitorCallback Class exists v5 (pre-diagnostics)
cli.py has preflight command def preflight exists v5 (pre-preflight)
cli.py has hpo_report command def hpo_report exists v5 (pre-hpo-report)
callbacks.py has CSVLoggingCallback Class exists v6 (pre-dual-logging)
config.py has logging or wandb field in RunConfig logging: str or wandb: bool in RunConfig v6 (pre-dual-logging)
provenance.py exists File exists v6 (pre-provenance)
cli.py has update_skills command def update_skills exists v7 (pre-TUI-tabs)
tools/monitor/src/hpo/mod.rs exists File exists v7 (pre-HPO-monitor)
config.py has wandb: bool field in RunConfig wandb: bool in RunConfig v8 (pre-wandb-toggle)
checkpoint.py has find_resume_checkpoint def find_resume_checkpoint exists v9 (pre-resume)
util.py has start_epoch parameter on Trainer.train start_epoch literal in util.py v9 (pre-resume)
All checks pass Current (up to date)

Read the full file on GitHub · 186 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 186 lines · 78 tokens per session scan C c69ad437eed4

Subscribe to this mod's changes

pytorch-migrate is a skill published in the GitHub repository Axect/pytorch_template (10 stars, last pushed 3mo ago), licensed MIT. It adds 78 tokens to every session and 2,286 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

addressing-pr-review-comments

Address all valid review comments on a PR for the current branch in the streamlit/streamlit repo. Covers both inline review comments and general PR (issue) comments. Use when a PR has reviewer feedback to address, including code changes, style fixes, and documentation updates.

streamlit/streamlit · 61 tokens

generating-changelog

Generates polished website release notes between two git tags for docs.streamlit.io. Use when preparing a new Streamlit release or reviewing changes between versions.

streamlit/streamlit · 35 tokens

understanding-streamlit-architecture

Explains Streamlit's internal architecture including backend runtime, frontend rendering, and WebSocket communication. Use when debugging cross-layer issues, understanding how features work end-to-end, planning architectural changes, or onboarding to the codebase. Covers ForwardMsg/BackMsg protocol, script rerun…

streamlit/streamlit · 75 tokens

debugging-streamlit

Debug Streamlit frontend and backend changes using make debug with hot-reload. Use when testing code changes, investigating bugs, checking UI behavior, or needing screenshots of the running app.

streamlit/streamlit · 41 tokens

fixing-flaky-e2e-tests

Diagnose and fix flaky Playwright e2e tests. Use when tests fail intermittently, show timeout errors, have snapshot mismatches, or exhibit browser-specific failures.

streamlit/streamlit · 43 tokens

fixing-streamlit-ci

Analyze and fix failed GitHub Actions CI jobs for the current branch/PR. Use when CI checks fail, PR checks show failures, or you need to diagnose lint/type/test errors and verify fixes locally.

streamlit/streamlit · 47 tokens