
deep-learning
PyTorch, TensorFlow, neural networks, CNNs, transformers, and deep learning for production
- Installs
- 484
- Last 24h
- +13
- Trending rank
- #7784
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-data-engineer --skill deep-learning- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads deep-learning automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Deep Learning
Production-grade deep learning with PyTorch, neural network architectures, and modern training practices.
Quick Start
# PyTorch Production Training Loop
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.optim import AdamW
from torch.optim.lr_scheduler import CosineAnnealingLR
import wandb
class TransformerClassifier(nn.Module):
def __init__(self, vocab_size: int, d_model: int = 256, n_heads: int = 8, n_classes: int = 2):
super().__init__()
self.embedding = nn.Embedding(vocab_size, d_model)
self.pos_encoding = nn.Parameter(torch.randn(1, 512, d_model))
encoder_layer = nn.TransformerEncoderLayer(d_model, n_heads, dim_feedforward=1024, batch_first=True)
self.transformer = nn.TransformerEncoder(encoder_layer, num_layers=6)
self.classifier = nn.Linear(d_model, n_classes)
self.dropout = nn.Dropout(0.1)
def forward(self, x, mask=None):
x = self.embedding(x) + self.pos_encoding[:, :x.size(1), :]
x = self.dropout(x)
x = self.transformer(x, src_key_padding_mask=mask)
x = x.mean(dim=1) # Global average pooling
return self.classifier(x)
# Training configuration
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = TransformerClassifier(vocab_size=30000).to(device)
optimizer = AdamW(model.parameters(), lr=1e-4, weight_decay=0.01)
scheduler = CosineAnnealingLR(optimizer, T_max=10)
criterion = nn.CrossEntropyLoss()
# Training loop with mixed precision
scaler = torch.cuda.amp.GradScaler()
for epoch in range(10):
model.train()
for batch in train_loader:
optimizer.zero_grad()
with torch.cuda.amp.autocast():
logits = model(batch["input_ids"].to(device))
loss = criterion(logits, batch["labels"].to(device))
scaler.scale(loss).backward()
scaler.step(optimizer)
scaler.update()
scheduler.step()
Core Concepts
1. Modern Neural Network Architectures
import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
"""Residual block with skip connection."""
def __init__(self, channels: int):
super().__init__()
self.conv1 = nn.Conv2d(channels, channels, 3, padding=1)
self.bn1 = nn.BatchNorm2d(channels)
self.conv2 = nn.Conv2d(channels, channels, 3, padding=1)
self.bn2 = nn.BatchNorm2d(channels)
def forward(self, x):
residual = x
x = F.relu(self.bn1(self.conv1(x)))
x = self.bn2(self.conv2(x))
return F.relu(x + residual)
class AttentionBlock(nn.Module):
"""Multi-head self-attention."""
def __init__(self, d_model: int, n_heads: int = 8):
super().__init__()
self.attention = nn.MultiheadAttention(d_model, n_heads, batch_first=True)
self.norm = nn.LayerNorm(d_model)
self.ffn = nn.Sequential(
nn.Linear(d_model, d_model * 4),
nn.GELU(),
nn.Linear(d_model * 4, d_model)
)
self.norm2 = nn.LayerNorm(d_model)
def forward(self, x, mask=None):
attn_out, _ = self.attention(x, x, x, attn_mask=mask)
x = self.norm(x + attn_out)
return self.norm2(x + self.ffn(x))
2. Training Best Practices
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import OneCycleLR
# Gradient clipping and accumulation
def train_epoch(model, loader, optimizer, accumulation_steps=4):
model.train()
optimizer.zero_grad()
for i, batch in enumerate(loader):
with torch.cuda.amp.autocast():
loss = model(batch) / accumulation_steps
scaler.scale(loss).backward()
if (i + 1) % accumulation_steps == 0:
scaler.unscale_(optimizer)
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
scaler.step(optimizer)
scaler.update()
optimizer.zero_grad()
# Early stopping
class EarlyStopping:
def __init__(self, patience: int = 5, min_delta: float = 0.001):
self.patience = patience
self.min_delta = min_delta
self.counter = 0
self.best_loss = float('inf')
def __call__(self, val_loss: float) -> bool:
if val_loss < self.best_loss - self.min_delta:
self.best_loss = val_loss
self.counter = 0
else:
self.counter += 1
return self.counter >= self.patience
# Learning rate finder
def find_lr(model, loader, optimizer, start_lr=1e-7, end_lr=10, num_iter=100):
lrs, losses = [], []
lr_mult = (end_lr / start_lr) ** (1 / num_iter)
for i, batch in enumerate(loader):
if i >= num_iter:
break
lr = start_lr * (lr_mult ** i)
for pg in optimizer.param_groups:
pg['lr'] = lr
loss = train_step(model, batch, optimizer)
lrs.append(lr)
losses.append(loss)
return lrs, losses
3. Model Deployment
import torch.onnx
import onnxruntime as ort
# Export to ONNX
def export_to_onnx(model, sample_input, path="model.onnx"):
model.eval()
torch.onnx.export(
model,
sample_input,
path,
export_params=True,
opset_version=17,
do_constant_folding=True,
input_names=['input'],
output_names=['output'],
dynamic_axes={'input': {0: 'batch_size'}, 'output': {0: 'batch_size'}}
)
# ONNX Runtime inference
class ONNXPredictor:
def __init__(self, model_path: str):
self.session = ort.InferenceSession(model_path, providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
def predict(self, input_data):
return self.session.run(None, {'input': input_data})[0]
# TorchScript for production
scripted_model = torch.jit.script(model)
scripted_model.save("model_scripted.pt")
Tools & Technologies
| Tool | Purpose | Version (2025) |
|---|---|---|
| PyTorch | Deep learning framework | 2.2+ |
| PyTorch Lightning | Training framework | 2.2+ |
| Hugging Face | Transformers, datasets | 4.38+ |
| ONNX Runtime | Model inference | 1.17+ |
| TensorRT | GPU optimization | 8.6+ |
| Weights & Biases | Experiment tracking | Latest |
| Ray | Distributed training | 2.9+ |
Troubleshooting Guide
| Issue | Symptoms | Root Cause | Fix |
|---|---|---|---|
| Vanishing Gradient | Loss not decreasing | Deep network, wrong activation | Use ReLU/GELU, residual connections |
| Exploding Gradient | NaN loss | Learning rate too high | Gradient clipping, lower LR |
| Overfitting | Train >> Val accuracy | Model too complex | Dropout, regularization, data aug |
| OOM Error | CUDA out of memory | Batch too large | Reduce batch, gradient accumulation |
| Slow Training | Low GPU utilization | Data loading bottleneck | More workers, prefetch |
Debug Commands
# Check GPU memory
print(torch.cuda.memory_summary())
# Profile training
with torch.profiler.profile(
activities=[torch.profiler.ProfilerActivity.CPU, torch.profiler.ProfilerActivity.CUDA]
) as prof:
train_step(model, batch, optimizer)
print(prof.key_averages().table(sort_by="cuda_time_total"))
# Gradient flow check
for name, param in model.named_parameters():
if param.grad is not None:
print(f"{name}: grad_mean={param.grad.mean():.6f}")
Best Practices
# ✅ DO: Use mixed precision training
with torch.cuda.amp.autocast():
output = model(input)
# ✅ DO: Initialize weights properly
def init_weights(m):
if isinstance(m, nn.Linear):
nn.init.xavier_uniform_(m.weight)
# ✅ DO: Use gradient checkpointing for large models
from torch.utils.checkpoint import checkpoint
x = checkpoint(self.layer, x)
# ✅ DO: Freeze base model for fine-tuning
for param in model.base.parameters():
param.requires_grad = False
# ❌ DON'T: Use dropout during inference
model.eval()
# ❌ DON'T: Forget to move data to device
Resources
- PyTorch Tutorials
- Hugging Face Course
- Fast.ai
- "Deep Learning" by Goodfellow et al.
Skill Certification Checklist:
- Can build and train neural networks in PyTorch
- Can implement attention mechanisms and transformers
- Can use mixed precision and gradient accumulation
- Can export models to ONNX/TorchScript
- Can debug training issues (gradients, memory)
FAQ
What does the deep-learning skill do?
PyTorch, TensorFlow, neural networks, CNNs, transformers, and deep learning for production
How do I install deep-learning?
Run npx skills add https://github.com/pluginagentmarketplace/custom-plugin-data-engineer --skill deep-learning in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/deep-learning/ (personal) or .claude/skills/deep-learning/ (project).
Which AI agents can use deep-learning?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is deep-learning safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains deep-learning?
It is published by pluginagentmarketplace in pluginagentmarketplace/custom-plugin-data-engineer. It has 484 recorded installs.
More from pluginagentmarketplace/custom-plugin-data-engineer
statistics-math
pluginagentmarketplace/custom-plugin-data-engineer
Open the skill to read its SKILL.md instructions.
big-data
pluginagentmarketplace/custom-plugin-data-engineer
Open the skill to read its SKILL.md instructions.
Popular education & science skills
teach
mattpocock/skills
Teach the user a new skill or concept, within this workspace.
scaffold-exercises
mattpocock/skills
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
paper-context-resolver
lllllllama/rigorpilot-skills
Rigor Paper Context helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacing README guidance by default.
caveman-learn
juliusbrussee/caveman
Act on a Caveman learn report - review the ranked token sinks, apply cost-lowering fixes with per-edit consent, and report what those fixes returned. Use when asked to lower an agent's token cost, what caveman has saved, to trim a heavy CLAUDE.md, or to offload re-pasted context into cavemem.
gsap-plugins
greensock/gsap-skills
Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.
teach-impeccable
pbakaus/impeccable
DEPRECATED: Use /impeccable teach instead. This command has been folded into the impeccable skill.