Official agent skill

Nvflare Convert Lightning

by NVIDIA in NVIDIA/skills

Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use only when the request names…

OfficialApache-2.0Auto-check passedAI & LLM Engineering

Install Nvflare Convert Lightning

skills CLI
$ npx skills add NVIDIA/skills --skill nvflare-convert-lightning -a claude-code

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

GitHub CLI
$ gh skill install NVIDIA/skills nvflare-convert-lightning --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/NVIDIA/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/nvflare-convert-lightning .claude/skills/nvflare-convert-lightning && 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
nvflare-convert-lightning
GitHub stars
3.5k
Token cost
~3.3k tokens
SKILL.md length
1,467 words
Files
26 (incl. references, assets)
Skills in repo
386
Repo updated
First seen
Licence
Apache-2.0

At a glance

Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use only when the request names…

  • Works in 5 steps: During inspection,… → For generated splits, relative paths, or… → After nvflare recipe show fedavg-pt… → …
  • Non-federated Lightning work such as DDP
  • SKILL.md covers Use When, Standard Path, Do Not Use When and Workflow, plus 2 more sections
  • Runs Python scripts from its folder; calls python

What it does

Nvflare Convert Lightning is an agent skill from NVIDIA/skills, published by the product's own GitHub organization. Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use only when the request names federated/NVFLARE conversion or asks multiple sites to train collaboratively while keeping each site's data local, and either names PyTorch Lightning or preliminary source inspection identifies one Lightning owner; do not use for non-federated Lightning work such as DDP, profiling, inference serving, or training-loop changes, nor for…

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 32 other files, including reference files and assets (for example `BENCHMARK.md`, `assets/lightning_client.py` and `evals/config.yml`).

It sits in AI & LLM Engineering, covering Deep learning. It works with PyTorch Lightning, PyTorch and TensorFlow. The repository describes itself as: Agent Skills for NVIDIA products — install into Claude Code, Codex, and other coding agents to run Physical AI, robotics, simulation, CUDA, and RAG workflows end to end. The licence is Apache-2.0.

When your agent uses it

  • Non-federated Lightning work such as DDP
  • Inference serving
  • Training-loop changes
  • Nor for plain PyTorch

Example prompts

  • “/nvflare-convert-lightning”

Requirements

  • Python 3

Workflow steps

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

  1. During inspection, references/lightning-detection.md.
  2. For generated splits, relative paths, or per-site data locations,
  3. After nvflare recipe show fedavg-pt --format json,
  4. During conversion, references/lightning-conversion.md, then
  5. Only after generated files exist,

What it can do on your machine

Read from SKILL.md and the folder at commit dfdd080. 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

    Ships script files (Python, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • 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

Nvflare Convert Lightning loads about 3.3k tokens when it runs, and up to ~11k if it reads all its reference files. Until then it costs about 165 tokens; SKILL.md has 1,467 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~165
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~11k

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 NVIDIA/skills at commit dfdd080, republished under its Apache-2.0 licence (© NVIDIA). 1,467 words, ~3,298 tokens.

Download SKILL.mdSave it as .claude/skills/nvflare-convert-lightning/SKILL.md (or your agent's skills folder). This skill also uses 25 other files; get the full folder from GitHub.
name
nvflare-convert-lightning
description
Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use only when the request names federated/NVFLARE conversion or asks multiple sites to train collaboratively while keeping each site's data local, and either names PyTorch Lightning or preliminary source inspection identifies one Lightning owner; do not use for non-federated Lightning work such as DDP, profiling, inference serving, or training-loop changes, nor for plain PyTorch, TensorFlow/Keras, other frameworks, deployment, POC/production lifecycle, or experiment workflows.
license
Apache-2.0
metadata.version
0.1.0
metadata.author
NVIDIA FLARE Team <federatedlearning@nvidia.com>
metadata.min-flare-version
2.9.0
metadata.blast-radius
runs_simulator
metadata.category
Conversion
metadata.tags
nvflare, federated-learning, pytorch-lightning, conversion
metadata.languages
python
metadata.frameworks
pytorch-lightning, pytorch, nvflare
metadata.domain
ml

NVFLARE Convert PyTorch Lightning

Use When

Use only when the user asks to convert PyTorch Lightning code into an NVFLARE federated training job; require both federation intent and Lightning ownership. Treat requests for multiple sites or institutions to train collaboratively while each site's data remains local as federation intent, even when the request does not say "federated" or "NVFLARE." Lightning source evidence alone is not sufficient. Relevant source may contain a LightningModule, LightningDataModule, a Trainer fit/validate/test loop, Lightning callbacks, checkpointing, or loggers. Supported: the PyTorch recipe family with flare.patch(trainer) as the model exchange integration, Lightning-native evaluation, custom aggregation through the same recipe aggregator= hook, and local validation and export.

Standard Path

Always read this converter SKILL.md with ../nvflare-shared/references/conversion-common.md. For an explicit-FedAvg conversion, load only these references, in workflow order:

  1. During inspection, references/lightning-detection.md.
  2. For generated splits, relative paths, or per-site data locations, ../nvflare-shared/references/site-data-and-paths.md.
  3. After nvflare recipe show fedavg-pt --format json, ../nvflare-shared/references/pytorch-family-recipe-construction.md.
  4. During conversion, references/lightning-conversion.md, then ../nvflare-shared/references/pytorch-model-exchange.md.
  5. Only after generated files exist, ../nvflare-shared/references/validation-evidence.md, then references/lightning-validation.md.

Complete each workflow phase before loading the next phase's reference. Do not enumerate reference directories or preload validation, DDP/tracking, broad workflow, dependency, runtime-output, or reporting references. Do not depend on NVFLARE repository examples.

Do Not Use When

Do not use for non-federated Lightning changes such as DDP-only configuration, profiling, inference serving, callbacks, early stopping, or schedulers; or for plain torch.nn.Module manual training loops without Lightning (route to nvflare-convert-pytorch), Hugging Face Trainer (route to nvflare-convert-huggingface), TensorFlow, XGBoost, scikit-learn, a failed job (route to nvflare-diagnose-job), federated statistics without training (route to nvflare-fed-stats), or generic Lightning debugging without FLARE intent; when the inspected project actively contains both Lightning and Hugging Face Trainer entrypoints, route to nvflare-orient. Out of conversion scope: production deployment, Kubernetes, POC lifecycle, deployment privacy/security policy design, custom distributed launch policies not expressible by product APIs, experiment tracking redesign, and experiment search across recipes. Privacy-protection requests — homomorphic encryption (HE) / encrypted aggregation, differential privacy, and privacy filters — are not supported: they require provisioning or deployment policy beyond conversion scope, so report such a request as unsupported and route it to provisioning/deployment, never substituting an unprotected recipe or disclaimer. If a request combines federated statistics and model-training conversion, treat it as two independent jobs and workflows: do not merge or automatically chain them, do not route the combination to nvflare-orient, and ask which workflow to run first before generating or running either job. Recommend nvflare-fed-stats first only when the user's purpose is to understand data distribution; handle conversion later as a separate request.

Workflow

  1. Apply ../nvflare-shared/references/conversion-common.md for the whole conversion; this SKILL.md states only the framework-specific deltas.
  2. Inspect before editing with nvflare agent inspect source <path> --format json plus direct reading; fact extraction is static. Confirm Lightning versus plain PyTorch and hand off to nvflare-convert-pytorch when no Lightning evidence exists. If inspection recommends nvflare-orient for active Lightning and Hugging Face Trainer owners, stop and hand off before editing.
  3. Apply the dependency-install ordering rule in ../nvflare-shared/references/conversion-common.md before any Python command imports user, Lightning, NVFLARE, or declared dependency modules. Determine applicable dependencies from the selected execution path first. If required data artifacts already exist and static inspection shows that the selected path will not reach a download helper or its imports, treat its download-only requirements as inapplicable: do not install or import-probe them. Probe only modules the generated conversion and selected validation path will execute, and keep an optional probe separate and exit-zero when unavailable.
  4. Identify the existing LightningModule, LightningDataModule, trainer construction, callbacks, checkpointing, validation_step/test_step and dataloaders, metrics, logger usage, source partition evidence, distributed process-spawning evidence, custom aggregation intent, and the concrete model constructor values that server and clients must share.
  5. Reuse the PyTorch recipe family; Lightning is not a separate recipe family. For the standard case — the user explicitly requests FedAvg and inspection identifies Lightning — run nvflare recipe show fedavg-pt --format json directly and construct it. For fedavg-pt, import FedAvgRecipe only from nvflare.app_opt.pt.recipes.fedavg, never from nvflare.recipe. Use FedEval for evaluation-only. After every recipe show, derive construction capabilities from the construction reference. Then use that documented path: do not run exploratory NVFLARE imports or use inspect, hasattr, constant discovery, SDK source/docstring reads, or lifecycle probes. If a required detail is absent, report a skill gap or fail closed instead of guessing. Call recipe.execute(SimEnv(...)).
  6. Convert the training entry point to the Lightning Client API: build the Trainer, call flare.patch(trainer), and let the patched trainer own model exchange. Keep evaluation inside Lightning per references/lightning-conversion.md and use self.log. Derive evaluate_only=True only for FedEval; omit it for training recipes so its default stays False. Derive evaluate_before_train = recipe_algorithm != "cyclic": Cyclic persists only its final sequential model; every other algorithm uses explicit validation for server metrics and, for training, best-model selection. Verify the key in server evidence or fail closed.
  7. Add or update job.py under the shared constructor-serialization rule. Use the recipe's class_path or path key plus complete args when values are needed; a permitted zero-argument instance is the complete module. Add requested aggregator= wiring and the metric, tensor-transport, server offload, and execution settings derived from the shared PyTorch-family construction profile. If sites need distinct train_args, make every site override the complete argument string; never split shared arguments and a site-specific data path across recipe-level and per-site values expecting a merge.
  8. Immediately after generated files exist and before any preflight, smoke test, cleanup, validation, or execution command, load the two validation references in Standard Path order. Before executing a full run, select and record exactly one final validation target:
    • for a requested local or first-run simulation without an export claim, run python job.py and do not export or run the exported simulator afterward;
    • for a requested exported/deployable artifact, export first and run only the exported folder with the simulator CLI; do not first run python job.py. If the selected full-run target fails, diagnose it, apply a scoped fix, and rerun that same target. Change targets only when evidence shows the original target does not represent the requested artifact, and record that reason. Export inspection belongs only to the exported path. Keep cleanup, export, and simulation as separate tool calls; never combine recursive cleanup with execution. Stop at the first failed validation rung before diagnosing it; do not add speculative recovery probes. Use the environment and permission mechanisms supplied by the agent host; do not inspect or enforce its security boundary.
  9. Report the recipe, changed files, selected validation target, validation status, metrics, and exact artifact paths.
Show full SKILL.md (396 more words)Show less

Non-standard Cases

Load only the reference matching an encountered case:

  • ../nvflare-shared/references/conversion-workflow.md for an unresolved non-standard rerun, authorization, or missing-semantics case; it no longer holds the data-location or partitioning contracts.
  • ../nvflare-shared/references/pytorch-family-recipe-selection.md for an ambiguous or non-FedAvg algorithm; use its catalog for FedAvg, FedOpt, FedProx, SCAFFOLD, Cyclic, Swarm, or FedEval, and reserve nvflare recipe list for these cases.
  • ../nvflare-shared/references/dependency-install.md when an applicable dependency is missing.
  • ../nvflare-shared/references/runtime-output-guidance.md for a read-only source root or user-chosen output destination.
  • references/lightning-ddp-and-tracking.md when inspection finds its trigger.
  • ../nvflare-shared/references/metrics-and-artifact-reporting.md when normal metric artifacts are absent or inconsistent.

Requirements

  • Must integrate through flare.patch(trainer) and let the patched trainer own model exchange. Must not generate a manual FLModel send/receive path as the default Lightning exchange, and must not pass the received input_model into the Trainer.
  • Must treat flare.receive() inside the patched loop as optional metadata or task-progression access only, not as a second model-load path.
  • Must keep evaluation inside Lightning (trainer.validate/trainer.test, validation_step, self.log); must not generate a raw PyTorch model.eval() loop for ordinary Lightning conversion.
  • Except for Cyclic, must run an explicit standalone trainer.validate(...) before trainer.fit(...) and rely on the patched callback to attach its finite scalar metrics; never populate model.__fl_meta__[MetaKey.INITIAL_METRICS]. Validation inside trainer.fit(...) is not a received-global-model metric. Cyclic must skip the pre-fit call and report its persisted final model, not a best model.
  • Must audit model constructor arguments before writing job.py by reading the LightningModule.__init__ signature and the selected recipe's model parameter from nvflare recipe show <recipe-name> --format json, not by reading NVFLARE library source. Emit the recipe-documented class_path or path key plus complete args for every required or overridden value. Direct LightningModule use is allowed only when unchanged zero-argument defaults reconstruct it. Values must be clear from source, configuration, or supplied metadata. Otherwise ask one semantic question when an answer channel exists or fail closed.
  • Must use the PyTorch recipe family; must not invent a Lightning-only recipe. Apply the construction reference after recipe show; it is canonical for optional recipe parameters, model selection, tensor transport, server disk offload, and execution mode.
  • Must preserve local-only callbacks and logger behavior where safe. Existing network-connected tracking, upload callbacks, and custom/unknown loggers are evidence, not a user request: keep them disabled during validation unless explicitly requested, and do not ask solely to enable them. This narrows references/lightning-conversion.md.
  • Must not make non-PyTorch-family skills load ../nvflare-shared/references/pytorch-model-exchange.md.
  • Site partitioning, custom aggregation, the Source Of Truth Boundary, and user input/authorization follow ../nvflare-shared/references/conversion-common.md.

© NVIDIA, 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

SKILL.md and 25 other files (references, assets) in skills/nvflare-convert-lightning of NVIDIA/skills.

  • SKILL.md
  • BENCHMARK.md
  • assets/lightning_client.py
  • evals/config.yml
  • evals/evals.json
  • evals/files/SOURCE.md
  • evals/files/external-data-lightning/model.py
  • evals/files/external-data-lightning/train.py
  • evals/files/factory-lightning/train.py
  • evals/files/gpu-device-lightning/model.py
  • evals/files/gpu-device-lightning/train.py
  • evals/files/hello-lightning/model.py
  • evals/files/hello-lightning/train.py
  • evals/files/routing-dual
  • … and 12 more

Open the folder on GitHubat commit dfdd080

Compare with similar skills

Nvflare Convert Lightning 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.

Nvflare Convert Lightning compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nvflare Convert Lightning this skillNVIDIA/skills3.5k—~3.3kAutomated safety check: PassApache-2.0
PyTorch Lightning TrainingOrchestra-Research/AI-Research-SKILLs13k6 repos~2.3kAutomated safety check: PassMIT
Formattingbrendanhasz/probflow175—~381Automated safety check: PassMIT
Embedded AI Deploymentmatlab/agent-skills-playground183—~3.4kAutomated safety check: PassCustom licence
Ray Train Distributed TrainingOrchestra-Research/AI-Research-SKILLs13k2 repos~2.7kAutomated safety check: PassMIT
PyTorch Lightning Training Setupdavila7/claude-code-templates32k11 repos~1.7kAutomated safety check: PassMIT

Similar skills

  • PyTorch Lightning Training

    Orchestra-Research/AI-Research-SKILLs

    Shows how to organize PyTorch training with Lightning's LightningModule and Trainer, covering validation, DDP, callbacks and learning-rate scheduling.

    13k GitHub starsUsed in 6 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Formatting

    brendanhasz/probflow

    Ensure consistent code formatting using the uv package manager and pre-commit.

    175 GitHub stars~381 tokensUpdated 12 days ago
    AI & LLM EngineeringAuto-check passed
  • Embedded AI Deployment

    matlab/agent-skills-playground

    Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder).

    183 GitHub stars~3.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Ray Train Distributed Training

    Orchestra-Research/AI-Research-SKILLs

    Scales PyTorch, TensorFlow and Hugging Face training from a single GPU to multi-node clusters with Ray Train, including Ray Tune sweeps and checkpoint recovery.

    13k GitHub starsUsed in 2 repos~2.7k tokens
    AI & LLM EngineeringAuto-check passed
  • PyTorch Lightning Training Setup

    davila7/claude-code-templates

    Organizes PyTorch training code into LightningModules, DataModules and Trainers, with multi-GPU strategies, callbacks and logging configured.

    32k GitHub starsUsed in 11 repos~1.7k tokens
    AI & LLM EngineeringAuto-check passed
  • Perforatedai

    PerforatedAI/PerforatedAI

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

    237 GitHub stars~17k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed

More from NVIDIA/skills

All 386 skills in this repo
  • Official

    A skill your agent uses when the user wants to deploy, run, debug, tear down, or call the REST API of the RTVI-CV 2D detection / tracking microservice.

    3.5k GitHub starsUsed in 1 repo~4.5k tokens
    Auto-check passed
  • Official

    Generates, validates, compares and explains HOLOLINK_def.svh macro files for the HSB IP, using bundled Python scripts and asking before it writes anything.

    3.5k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Official

    Runs and validates an end-to-end Mission Control demo in a locally installed Isaac Sim, with a Nova Carter robot driven through a Python server.

    3.5k GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Orchestrates defect image generation for PCBA, metal surface and glass inspection with NVIDIA Cosmos AnomalyGen on OSMO, from cold-start Day 0 to real-photo Day 1 labeling.

    3.5k GitHub stars~5k tokensUpdated today
    Auto-check: notes
  • Orchestrates video data augmentation and auto-labeling workflows on OSMO, from flow selection and preflight checks to submission, monitoring and output download.

    3.5k GitHub stars~4.7k tokensUpdated today
    Auto-check: notes
  • Official

    Runs NVIDIA TAO Data Services KPI analysis on object detection results, comparing predictions to ground truth and writing per-class precision, recall and AP to a CSV.

    3.5k GitHub stars~2.7k tokensUpdated today
    Auto-check: notes

Questions about Nvflare Convert Lightning

What does Nvflare Convert Lightning do?

Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use only when the request names…. Nvflare Convert Lightning is an agent skill from NVIDIA/skills, published by the product's own GitHub organization.

When should I use Nvflare Convert Lightning?

Nvflare Convert Lightning fits situations like: non-federated Lightning work such as DDP; inference serving; training-loop changes; nor for plain PyTorch.

How do I install Nvflare Convert Lightning in Claude Code?

Run `npx skills add NVIDIA/skills --skill nvflare-convert-lightning -a claude-code`. Or copy the skill folder (skills/nvflare-convert-lightning in NVIDIA/skills) into .claude/skills/nvflare-convert-lightning in your project. Claude Code loads it when a task matches its description.

How do I install Nvflare Convert Lightning in Codex?

Run `npx skills add NVIDIA/skills --skill nvflare-convert-lightning -a codex`. Or copy the skill folder (skills/nvflare-convert-lightning in NVIDIA/skills) into .agents/skills/nvflare-convert-lightning in your project. Codex loads it when a task matches its description.

Can I use Nvflare Convert Lightning 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 NVIDIA/skills --skill nvflare-convert-lightning -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nvflare-convert-lightning, .gemini/skills/nvflare-convert-lightning, .github/skills/nvflare-convert-lightning and .opencode/skills/nvflare-convert-lightning in your project.

What does Nvflare Convert Lightning need to run?

Going by SKILL.md and its folder, Nvflare Convert Lightning needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Nvflare Convert Lightning 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 Nvflare Convert Lightning 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 Nvflare Convert Lightning use?

Nvflare Convert Lightning is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Nvflare Convert Lightning use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.8k tokens, read only when the agent opens those files.

What are the alternatives to Nvflare Convert Lightning?

Skills that share tags, products or a category with Nvflare Convert Lightning: PyTorch Lightning Training (Orchestra-Research/AI-Research-SKILLs, 13k stars), Formatting (brendanhasz/probflow, 175 stars), Embedded AI Deployment (matlab/agent-skills-playground, 183 stars) and Ray Train Distributed Training (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 Nvflare Convert Lightning?

NVIDIA (a GitHub organization, an official publisher) maintains it in NVIDIA/skills, which has 3,546 GitHub stars. The repository holds 386 skills in this directory. The repository was last updated on October 9, 2026.

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