pytorch-train

A configuration-based workflow for training machine-learning models built with PyTorch, a popular Python framework for deep learning.

In plain words
What is it for?
Creating experiment files, running hyperparameter optimization with Optuna, selecting the best settings, and running final regression or classification training.
Why use it?
It organizes model training into repeatable configuration and experiment steps, reducing manual setup and making it easier to compare settings.

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-train
Any agent
npx skills add Axect/pytorch_template --skill pytorch-train
Clone the repo
git clone --depth 1 https://github.com/Axect/pytorch_template

Made for: Claude Code, Codex.

Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,898 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00127 $0.02898
Opus 5 $0.00063 $0.01449
Sonnet 5 $0.00025 $0.00580
Haiku 4.5 $0.00013 $0.00290

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

Security

Grade A, and why

pytorch-train scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pytorch-train/SKILL.md · 300 lines

How it starts

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

pytorch-train

Train models through this template's full pipeline: config creation, HPO, best-param extraction, and final training.

Usage

/pytorch-train [phase] [options]

Phases (auto-detected from user intent if omitted):

  • full — Complete pipeline (Phases 1-5)
  • config — Create config files only (Phases 1-2)
  • hpo — Run HPO (Phase 3, assumes configs exist)
  • extract — Extract best params from completed HPO (Phase 4)
  • train — Run final training with best.yaml (Phase 5)

Phase 1: Gather Requirements

Before creating any files, confirm these with the user:

Item Example Notes
Project name SolarFlux, WavePredict Used in project: field and directory names
Version v0.3, v1.32 Determines config subdirectory
Model name fluxnet, wavenet, mlp File prefix and net: path
Task type regression / classification Determines criterion, metric direction
Model module path model.MLP, recipes.regression.model.MLP Importlib path for net: field
net_config {nodes: 64, layers: 4} Architecture hyperparameters
Data loader existing load_data() or needs new one Recipe scaffolding if needed
Device cuda:0 (default if available) GPU index

Task Type Defaults

Setting Regression Classification
criterion torch.nn.MSELoss torch.nn.CrossEntropyLoss
criterion_config {} {}
metric (HPO) val_loss val_loss
direction (HPO) minimize minimize

Pre-flight Check (Before HPO)

After creating configs, always run preflight before HPO:

python -m cli preflight configs/<DIR>/<model>_run.yaml --device cuda:0

Preflight runs 1 batch forward+backward and checks:

  • Import paths and device availability
  • Semantic validation (upper_bound >= total_steps, lr > 0, etc.)
  • Model/optimizer/scheduler/criterion instantiation
  • Data loading via the config's data field
  • Forward pass (output shape vs target shape)
  • Backward pass (gradient NaN/Inf detection, grad norm)
  • GPU memory estimate

Read the full file on GitHub · 300 lines

Files

What ships with it

2 files 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 · 300 lines · 127 tokens per session scan A 2028f2104e07

Subscribe to this mod's changes

pytorch-train is a skill published in the GitHub repository Axect/pytorch_template (10 stars, last pushed 3mo ago), licensed MIT. It adds 127 tokens to every session and 2,898 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. 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

perforatedai

Expert in PerforatedAI library for adding artificial dendrites to PyTorch neural networks. Triggers: 'Perforate my model' (start interactive setup), 'debug my perforated model' (debug/optimize existing integration), 'load my perforated model for inference' (deploy trained models). Also use when: debugging dendrite…

PerforatedAI/PerforatedAI · 115 tokens

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