Agent skill

Perforatedai Complex Methods

by PerforatedAI in PerforatedAI/PerforatedAI

Solutions for non-trivial PerforatedAI integration scenarios.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Perforatedai Complex Methods

skills CLI
$ npx skills add PerforatedAI/PerforatedAI --skill perforatedai-complex-methods -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PerforatedAI/PerforatedAI perforatedai-complex-methods --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PerforatedAI/PerforatedAI.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/perforatedai-complex-methods .claude/skills/perforatedai-complex-methods && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
perforatedai-complex-methods
GitHub stars
237
Token cost
~821 tokens
SKILL.md length
281 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
Apache-2.0

At a glance

Solutions for non-trivial PerforatedAI integration scenarios.

  • Works in 3 steps: Rebuild optimizer AND scheduler… → Rebuild the scaler too if using AMP —… → Call…
  • Standard integration hits edge cases such as AMP (Automatic Mixed Precision) / GradScaler crashes in p mode
  • SKILL.md covers AMP (Automatic Mixed… and Optimizer Rebuild After…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Perforatedai Complex Methods is an agent skill from PerforatedAI/PerforatedAI. Solutions for non-trivial PerforatedAI integration scenarios. Use when standard integration hits edge cases such as AMP (Automatic Mixed Precision) / GradScaler crashes in p mode, or other advanced setups not covered by the main perforatedai skill.

Its SKILL.md is about 820 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Deep learning. The repository describes itself as: Add Dendrites to your PyTorch Project. The licence is Apache-2.0.

When your agent uses it

  • Standard integration hits edge cases such as AMP (Automatic Mixed Precision) / GradScaler crashes in p mode
  • Other advanced setups not covered by the main perforatedai skill

Example prompts

  • “Use the perforatedai-complex-methods skill to solution for non-trivial PerforatedAI integration scenarios”
  • “/perforatedai-complex-methods”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Rebuild optimizer AND scheduler identically to initial setup — extract this into a shared function so both call sites are guaranteed…
  2. Rebuild the scaler too if using AMP — the old scaler has stale state tied to the previous optimizer
  3. Call GPA.pai_tracker.set_optimizer_instance(optimizer) after rebuilding so PAI can re-sync its param groups for the new mode

What it can do on your machine

Read from SKILL.md and the folder at commit 9d317e6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Perforatedai Complex Methods loads about 821 tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 281 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~821

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PerforatedAI/PerforatedAI at commit 9d317e6, republished under its Apache-2.0 licence (© PerforatedAI). 281 words, ~821 tokens.

Download SKILL.mdSave it as .claude/skills/perforatedai-complex-methods/SKILL.md (or your agent's skills folder).
name
perforatedai-complex-methods
description
Solutions for non-trivial PerforatedAI integration scenarios. Use when standard integration hits edge cases such as AMP (Automatic Mixed Precision) / GradScaler crashes in p mode, or other advanced setups not covered by the main perforatedai skill.

PerforatedAI Complex Methods

This skill documents solutions for non-trivial integration scenarios with PerforatedAI.


AMP (Automatic Mixed Precision) with PAI p Mode

The Problem

When using torch.cuda.amp.GradScaler with PAI, training will crash in p mode with:

AssertionError: No inf checks were recorded for this optimizer.
Why It Happens

PAI uses a backward hook to run a second, separate loss.backward() for dendrite training in p mode. This hook fires after your main backward call.

In p mode:

  • scaler.scale(loss).backward() runs — this registers inf checks only for params that receive gradients through this call, which are the main_module params (not in the optimizer in p mode)
  • PAI's backward hook fires its own unscaled backward() — dendrite params (which ARE in the optimizer) receive gradients through this unscaled call
  • scaler.step(optimizer) checks the optimizer's param groups for recorded inf checks, finds none (dendrite grads came from the unscaled hook backward), and asserts
The Fix

Bypass the scaler entirely in p mode. PAI's hook handles the dendrite backward correctly without it:

python
optimizer.zero_grad(set_to_none=True)
if scaler is not None and GPA.pai_tracker.member_vars['mode'] != 'p':
    scaler.scale(loss).backward()
    scaler.step(optimizer)
    scaler.update()
else:
    loss.backward()
    optimizer.step()
Why This Is Safe
  • In n mode (main network training): AMP runs normally with full scaler benefits
  • In p mode (dendrite training): the scaler is bypassed; PAI's hook-driven backward is already unscaled and handles dendrite gradient computation correctly. AMP precision is not needed for the dendrite training phase.

Optimizer Rebuild After Restructure

When add_validation_score returns restructured=True, the model has been modified and the optimizer must be fully rebuilt. Key points:

  1. Rebuild optimizer AND scheduler identically to initial setup — extract this into a shared function so both call sites are guaranteed identical
  2. Rebuild the scaler too if using AMP — the old scaler has stale state tied to the previous optimizer
  3. Call GPA.pai_tracker.set_optimizer_instance(optimizer) after rebuilding so PAI can re-sync its param groups for the new mode
python
def build_optimizer_and_scheduler(model, data_loader_train, args):
    optimizer = torch.optim.SGD(model.parameters(), lr=args.lr, ...)
    scaler = torch.cuda.amp.GradScaler() if args.amp else None
    # ... build scheduler ...
    return optimizer, lr_scheduler, scaler

# Initial setup
optimizer, lr_scheduler, scaler = build_optimizer_and_scheduler(student, data_loader_train, args)
GPA.pai_tracker.set_optimizer_instance(optimizer)

# After restructure
elif restructured and not training_complete:
    optimizer, lr_scheduler, scaler = build_optimizer_and_scheduler(student, data_loader_train, args)
    GPA.pai_tracker.set_optimizer_instance(optimizer)

© PerforatedAI, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/perforatedai-complex-methods of PerforatedAI/PerforatedAI.

Open the folder on GitHubat commit 9d317e6

Compare with similar skills

Perforatedai Complex Methods next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Perforatedai Complex Methods compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Perforatedai Complex Methods this skillPerforatedAI/PerforatedAI237—~821Automated safety check: PassApache-2.0
Add Uint Supportpytorch/pytorch104k2 repos~2.3kAutomated safety check: PassCustom licence
Segment Anything Model GuideOrchestra-Research/AI-Research-SKILLs13k9 repos~3.3kAutomated safety check: PassMIT
Add Oponnx/onnx22k—~1.2kAutomated safety check: PassApache-2.0
CLIP Image-Text MatchingOrchestra-Research/AI-Research-SKILLs13k8 repos~1.7kAutomated safety check: PassMIT
Add Function Bodyonnx/onnx22k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Add Uint Support

    pytorch/pytorch

    Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.

    104k GitHub starsUsed in 2 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 9 repos~3.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Op

    onnx/onnx

    Add a new ONNX operator or update an existing operator to a new opset version.

    22k GitHub stars~1.2k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • CLIP Image-Text Matching

    Orchestra-Research/AI-Research-SKILLs

    Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

    13k GitHub starsUsed in 8 repos~1.7k tokens
    AI & LLM EngineeringAuto-check passed
  • Add a function body definition to an ONNX operator, defining how it decomposes into simpler ops.

    22k GitHub stars~1.1k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Paddle Design Distributed

    PaddlePaddle/Paddle

    A skill your agent uses when working with Paddle's distributed training system: understanding parallelism strategies (DP, ZeRO, TP, PP, SP), semi-automatic parallel with ProcessMesh + shardtensor…

    24k GitHub stars~660 tokensUpdated 8 days ago
    AI & LLM EngineeringAuto-check passed

More from PerforatedAI/PerforatedAI

  • Perforatedai Libraries Transformers

    PerforatedAI/PerforatedAI

    HuggingFace Transformers integration for PerforatedAI. An agent skill from PerforatedAI/PerforatedAI.

    237 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Perforatedai Plot

    PerforatedAI/PerforatedAI

    Render a single-panel PAI figure of score versus parameter count from sweep CSVs, PAI run folders, or hand-supplied numbers.

    237 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Perforatedai

    PerforatedAI/PerforatedAI

    Expert in PerforatedAI library for adding artificial dendrites to PyTorch neural networks.

    237 GitHub stars~17k tokensUpdated today
    Auto-check passed
  • Perforatedai Analyze

    PerforatedAI/PerforatedAI

    Analyze PerforatedAI training results and provide optimization recommendations.

    237 GitHub stars~5.1k tokensUpdated today
    Auto-check passed
  • Perforatedai Wandb

    PerforatedAI/PerforatedAI

    WandB-specific PerforatedAI integration guardrail skill. An agent skill from PerforatedAI/PerforatedAI.

    237 GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Perforatedai Distributed

    PerforatedAI/PerforatedAI

    Multi-GPU setup for PerforatedAI with DataParallel or DistributedDataParallel (DDP).

    237 GitHub stars~5.5k tokensUpdated today
    Auto-check passed

Questions about Perforatedai Complex Methods

What does Perforatedai Complex Methods do?

Solutions for non-trivial PerforatedAI integration scenarios. Perforatedai Complex Methods is an agent skill from PerforatedAI/PerforatedAI. Solutions for non-trivial PerforatedAI integration scenarios.

When should I use Perforatedai Complex Methods?

Perforatedai Complex Methods fits situations like: standard integration hits edge cases such as AMP (Automatic Mixed Precision) / GradScaler crashes in p mode; other advanced setups not covered by the main perforatedai skill.

How do I install Perforatedai Complex Methods in Claude Code?

Run `npx skills add PerforatedAI/PerforatedAI --skill perforatedai-complex-methods -a claude-code`. Or copy the skill folder (skills/perforatedai-complex-methods in PerforatedAI/PerforatedAI) into .claude/skills/perforatedai-complex-methods in your project. Claude Code loads it when a task matches its description.

How do I install Perforatedai Complex Methods in Codex?

Run `npx skills add PerforatedAI/PerforatedAI --skill perforatedai-complex-methods -a codex`. Or copy the skill folder (skills/perforatedai-complex-methods in PerforatedAI/PerforatedAI) into .agents/skills/perforatedai-complex-methods in your project. Codex loads it when a task matches its description.

Can I use Perforatedai Complex Methods in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PerforatedAI/PerforatedAI --skill perforatedai-complex-methods -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/perforatedai-complex-methods, .gemini/skills/perforatedai-complex-methods, .github/skills/perforatedai-complex-methods and .opencode/skills/perforatedai-complex-methods in your project.

What does Perforatedai Complex Methods need to run?

SKILL.md names no scripts, command-line tools or credentials: Perforatedai Complex Methods is instructions for the agent only. Our summary lists: Python 3.

Does Perforatedai Complex Methods access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Perforatedai Complex Methods safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Perforatedai Complex Methods use?

Perforatedai Complex Methods is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Perforatedai Complex Methods use?

About 821 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Perforatedai Complex Methods?

Skills that share tags, products or a category with Perforatedai Complex Methods: Add Uint Support (pytorch/pytorch, 104k stars), Segment Anything Model Guide (Orchestra-Research/AI-Research-SKILLs, 13k stars), Add Op (onnx/onnx, 22k stars) and CLIP Image-Text Matching (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Perforatedai Complex Methods?

PerforatedAI (a GitHub organization) maintains it in PerforatedAI/PerforatedAI, which has 237 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.

Source: PerforatedAI/PerforatedAI on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.