nvflare-convert-pytorch
Skill1k starsChanged 12 days agoApache-2.0View on GitHub
Convert existing plain or manual PyTorch training code into an NVFLARE federated job using Client API model exchange, local validation, and job export; use when the user names plain PyTorch or preliminary source inspection identifies one plain-PyTorch owner, and not for Lightning, other frameworks, deployment, POC/production lifecycle, or experiment workflows.
1 other project uses a version of this.
Trending
Less talk lately.about the whole repository
Most recently taken up by
- NVIDIA/skillsword for word, first seen Oct 1, 2026
Who's talking about NVIDIA/NVFlare
- Kaggle/kaggle-sdk-python“kagglesdk 0.1.31 and 0.1.32 import a missing competitions.legacy package”GitHub · Jun 30, 2026 · 1 reactions
- londonaicentre/FLIP“docs: call the NVIDIA framework FLARE, its short official name”GitHub · Oct 17, 2026
- NVIDIA/SkillEvaluator“[BUG]: Generated BENCHMARK.md does not faithfully explain a passing gate and splits canonical case IDs”GitHub · Oct 9, 2026
- Denimworld12/Hospital-Chain“feat: run hospital nodes on separate machines with provisioning kits and a cross-address verifier”GitHub · Oct 2, 2026
- ai4os/ai4os-nvflare“Update NVFlare version to 2.8”GitHub · Jul 16, 2026
The biggest 5 of 25 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 25
Talked about on GitHub (25 times).
On GitHub · 25
- Jun 30, 2026kagglesdk 0.1.31 and 0.1.32 import a missing competitions.legacy package — Kaggle/kaggle-sdk-python1 reaction · 2 comments
- Oct 17, 2026docs: call the NVIDIA framework FLARE, its short official name — londonaicentre/FLIP0 reactions · 1 comment
- Oct 9, 2026[BUG]: Generated BENCHMARK.md does not faithfully explain a passing gate and splits canonical case IDs — NVIDIA/SkillEvaluatorsays it tested it0 reactions · 1 comment
- Oct 2, 2026feat: run hospital nodes on separate machines with provisioning kits and a cross-address verifier — Denimworld12/Hospital-Chain0 reactions
- Jul 16, 2026Update NVFlare version to 2.8 — ai4os/ai4os-nvflare0 reactions
20 more on GitHub
- Jul 6, 2026Upgrade NVFlare backbone 2.7.2 → 2.8.0 (deferred until a clean 2.7.2 run) — KatherLab/MediSwarm0 reactions · 3 comments
- Jun 26, 2026Upgrade NVFLARE backend 2.7.2 → 2.8.0 — londonaicentre/FLIP0 reactions
- Jun 22, 2026Add step-ca ephemeral admin certs — pcnudde/NVFlare0 reactions · 1 comment
- May 7, 2026feat(privacy): federated learning architecture-ready (Horizon Europe / EU4Health alignment) — Yanstart/VarunaPoC0 reactions · 1 comment
- Jan 7, 2026T3: Model fitting (deploying GWAS tool / model on every client) [Enamul, ++] — collaborativebioinformatics/FedGen0 reactions
- Sep 10, 2025[Feature]: From Vertical FL feasibility (#363) to first example — londonaicentre/FLIP0 reactions · 1 comment
- Jun 23, 2025Secure xgboost example — RhinoHealth/user-resources0 reactions · 3 comments
- May 14, 2025NVFlare backbone upgrade for better connection performance — KatherLab/MediSwarm0 reactions · 2 comments
- Mar 24, 2025NVFlare Integration — KCL-BMEIS/UltraFlwr0 reactions
- Jul 14, 2024Try to fix experiment already exist issue in `MLFlowHandler` — Project-MONAI/MONAI0 reactions · 11 comments
- Sep 13, 2023Add stats_sender to MonaiAlgo for FL stats — Project-MONAI/MONAI0 reactions · 1 comment
- Aug 9, 2023【CS-part3】New submissions for Wed, 9 Aug 23 — Yukeaaa/arxiv-daily0 reactions
- Jul 12, 2023New learner cifar10 — yanchengnv/NVFlare0 reactions
- May 6, 2023Bump nvflare from 2.0.10 to 2.3.0 in /federated_learning — NVIDIA/fsi-samples0 reactions · 1 comment
- Mar 22, 2023[WIP] add `FLStatsHandler` — Project-MONAI/MONAI0 reactions · 3 comments
- Mar 21, 2023Try NVFlare cifar10 example — KatherLab/swarm-learning-hpe0 reactions
- Mar 21, 2023Apply the new data split strategies — KatherLab/swarm-learning-hpe0 reactions
- Dec 6, 2022How to use bst.eval_set() and bst.update() with xgboost_ray — ray-project/xgboost_ray0 reactions · 3 comments
- May 18, 2022713 Update nvflare example for 2.1 — Project-MONAI/tutorials0 reactions · 2 comments
- Mar 22, 2022Bump nvflare from 2.0.2 to 2.0.16 in /federated_learning/nvflare/nvflare_spleen_example — Project-MONAI/tutorials0 reactions · 4 comments
Other versions1 project uses a version of this.
Word for word · 1
- NVIDIA/skills★ 3.9k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- examples/tutorials/self-paced-training/AGENTS.mdAGENTS.md
- research/auto-fl-research/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- research/auto-fl-research/CLAUDE.mdCLAUDE.md
- autofl-nvflare-reportSkill
- autofl-nvflareSkill
- nvflare-autofl-reportSkill
- nvflare-autoflSkill
- nvflare-convert-huggingfaceSkill
- nvflare-convert-lightningSkill
- nvflare-diagnose-jobSkill
- nvflare-fed-statsSkill
- nvflare-orientSkill
- nvflare-sharedSkill
- nvflare-example-skillSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 0 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 21
Use when converting an existing plain PyTorch training script, torch.nn.Module, manual training loop, state_dict workflow, data loader, …
- Very specific: line 28
Do not use for PyTorch Lightning (route to nvflare-convert-lightning), Hugging Face Trainer (route to nvflare-convert-huggingface), …
- Very specific: line 37
If a request combines federated statistics and model-training conversion, treat it as two independent jobs and workflows: do not merge or …
- Very specific: line 87
Add or update job.py under the shared constructor-serialization rule: use explicit class_path (or documented path alias) plus complete args …
- Very specific: line 108
Must audit model constructor arguments before writing job.py by reading the model module's __init__ and the selected recipe's model …
- Very specific: line 117
Must follow ../nvflare-shared/references/pytorch-model-exchange.md and references/pytorch-client-api-conversion.md for the canonical …
- Very specific: line 124
Never patch a framework-neutral runtime module or register FOBS handlers in client.py.
- Very specific: line 126
Must convert source evaluation alongside training and return metrics through FLModel.metrics.
- Very specific: line 129
Must count completed local optimizer steps in each generated training round and send that positive value as MetaKey.NUM_STEPS_CURRENT_ROUND.
- Very specific: line 133
Must load checkpoints with torch.load(..., weights_only=True).
- Very specific: line 136
Must not make non-PyTorch-family skills load ../nvflare-shared/references/pytorch-model-exchange.md.
- Very specific: line 143
Always read this converter SKILL.md together with ../nvflare-shared/references/conversion-common.md.
- Very specific: line 171
Do not load every reference preemptively, and do not depend on NVFLARE repository examples being present in the user's environment.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
NVFLARE Convert PyTorch
Use When
Use when converting an existing plain PyTorch training script, torch.nn.Module,
manual training loop, state_dict workflow, data loader, checkpoint, or metric loop
into an NVFLARE federated training job. Supports horizontal FL, Client API model
exchange with FLModel, recipe aggregator= hooks, validation, and export.
Do Not Use When
Do not use for PyTorch Lightning (route to nvflare-convert-lightning), Hugging Face Trainer (route to nvflare-convert-huggingface), TensorFlow, XGBoost,
scikit-learn, failed jobs (route to
nvflare-diagnose-job), federated statistics without training (route to
nvflare-fed-stats), or generic PyTorch debugging without FLARE intent. Out of
scope: production deployment, Kubernetes, POC lifecycle, privacy/security policy design,
controller/workflow rewrites outside recipe or Job APIs, experiment search, and
data distribution experiments beyond minimal validation setup. Privacy-protection
requests — HE/encrypted aggregation, differential privacy, and privacy filters — need provisioning/deployment
policy; route onward rather than substituting an unprotected recipe or adding only a 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
- Load
../nvflare-shared/references/conversion-common.mdand apply it for the whole conversion; this SKILL.md states only the framework-specific deltas. Load../nvflare-shared/references/conversion-workflow.mdonly for a non-standard rerun, authorization, or missing-semantics case; it no longer holds the data-location or partitioning contracts, whose invariantsconversion-common.mdowns. Load../nvflare-shared/references/site-data-and-paths.mdfor generated partitions, relative paths, or per-site data locations. - Inspect before editing with
nvflare agent inspect source <path> --format jsonplus direct reading. Fact extraction is static; do not import or execute user training modules to discover fields. Extract: training entrypoint, model class path and constructor args, checkpoint behavior, train/eval functions, data loading, metric names and denominators, local epochs/steps, requested client and round counts, source data split or partition evidence, tracking evidence, DDP evidence, and any custom aggregation intent. - Apply the dependency-install ordering rule in
../nvflare-shared/references/conversion-common.mdbefore any Python command imports user, PyTorch, NVFLARE, or declared dependency modules. - Select the recipe from the requested FL workflow, not from PyTorch alone. For
the standard case — the user explicitly requests FedAvg and inspection
identifies PyTorch — run
nvflare recipe show fedavg-pt --format jsondirectly and construct it; do not add per-site recipe config unless sites actually differ. Load../nvflare-shared/references/pytorch-family-recipe-selection.md(discovery, algorithm guide, catalog-based selection, HE-not-supported rule) only for ambiguous or non-FedAvg algorithms, reservingnvflare recipe listfor those cases. Use the module, class, and parameters returned byrecipe showfor standardjob.pyconstruction; forfedavg-pt, importFedAvgRecipefromnvflare.app_opt.pt.recipes.fedavg, never fromnvflare.recipe. After everyrecipe show, load../nvflare-shared/references/pytorch-family-recipe-construction.mdand derive the recipe's construction capabilities. Loadreferences/recipe-selection.mdonly when non-FedAvg or execution-mode details are needed. - Convert training and evaluation as a pair using
references/pytorch-client-api-conversion.md: initialize FLARE, receive anFLModel, loadparams, evaluate the received global model, train, and send anFLModelwith updatedparams,metrics, and the actual completed local optimizer-step count inNUM_STEPS_CURRENT_ROUND. Adapt the user's evaluation code into the packaged evaluation template; if evaluation is required but missing, ask or fail closed. Apply the step-1 data-location rules to the generated client's data argument. - Add or update
job.pyunder the shared constructor-serialization rule: use explicitclass_path(or documentedpathalias) plus completeargswhenever reconstruction needs values. Add requestedaggregator=wiring, metric, tensor-transport, server offload, and execution settings derived from the shared PyTorch-family construction profile. - Validate in a ladder per
../nvflare-shared/references/validation-evidence.md: compile checks, recipe construction, one final full-run path chosen by the artifact being validated, with export and package inspection only for the selected exported-artifact path. For a local target, inspect the materialized configs and packaging evidence after that run. Usereferences/job-validation.mdfor PyTorch-specific failures. Stop at the first failed rung and report the product error. Use the environment and permission mechanisms supplied by the agent host; do not inspect or enforce its security boundary. - Report the recipe, changed files, validation status, metrics, and exact
artifact paths. Load
../nvflare-shared/references/metrics-and-artifact-reporting.mdonly when normal metric artifacts are absent or inconsistent.
Requirements
- Must audit model constructor arguments before writing
job.pyby reading the model module's__init__and the selected recipe'smodelparameter fromnvflare recipe show <recipe-name> --format json, not by reading NVFLARE library source. Emit the selected recipe's documentedclass_pathorpathkey plus completeargsfor every required or overridden constructor value; a directtorch.nn.Moduleis allowed only when unchanged zero-argument defaults reconstruct it. Values must be statically clear from literal source, configuration, or supplied metadata. Otherwise ask one semantic question when an answer channel exists or fail closed. - Must follow
../nvflare-shared/references/pytorch-model-exchange.mdandreferences/pytorch-client-api-conversion.mdfor the canonical plain-PyTorch payload and round-loop pattern. - Must apply
../nvflare-shared/references/pytorch-family-recipe-construction.mdafterrecipe show; it is the canonical policy for optional recipe parameters, model selection, tensor transport, server disk offload, and execution mode. Never patch a framework-neutral runtime module or register FOBS handlers inclient.py. - Must convert source evaluation alongside training and return metrics through
FLModel.metrics; must not synthesize metric semantics without source evidence. - Must count completed local optimizer steps in each generated training round
and send that positive value as
MetaKey.NUM_STEPS_CURRENT_ROUND. This is the FedAvg aggregation weight; do not omit it, reuse a cumulative count, or invent a value when the source loop cannot establish it. - Must load checkpoints with
torch.load(..., weights_only=True); a checkpoint that needs full unpickling is ask/fail, perreferences/pytorch-client-api-conversion.md. - Must not make non-PyTorch-family skills load
../nvflare-shared/references/pytorch-model-exchange.md; that reference is for plain PyTorch, PyTorch Lightning, and Hugging Face Trainer model/state-dict exchange only. - Site partitioning, custom aggregation, the Source Of Truth Boundary, and user
input/authorization follow
../nvflare-shared/references/conversion-common.md.
Always read this converter SKILL.md together with
../nvflare-shared/references/conversion-common.md. The standard routing,
recipe selection, and reporting path is inline, so common FedAvg does not load
broad policy or algorithm-selection references. Load the client template,
model-exchange reference, validation reference, and aggregator asset only when
their phase needs them. Load other detailed references only for exceptions:
../nvflare-shared/references/conversion-workflow.mdfor the full conversion contract when a case is non-standard;../nvflare-shared/references/site-data-and-paths.mdonly for generated site partitions, relative-path resolution, or per-site data locations;../nvflare-shared/references/pytorch-family-recipe-selection.mdonly for ambiguous or non-FedAvg algorithms, andreferences/recipe-selection.mdonly for non-FedAvg or execution-mode construction details not supplied byrecipe show;../nvflare-shared/references/pytorch-family-recipe-construction.mdafter everyrecipe show;../nvflare-shared/references/dependency-install.mdonly when an install is needed;../nvflare-shared/references/runtime-output-guidance.mdonly for read-only source roots or user-chosen output destinations;../nvflare-shared/references/metrics-and-artifact-reporting.mdonly when metrics are absent or inconsistent;../nvflare-shared/references/validation-evidence.mdbefore validation, and../nvflare-shared/references/pytorch-model-exchange.mdonly for PyTorch-family exchange;references/pytorch-client-api-conversion.mdfor Client API conversion, andreferences/job-validation.mdfor PyTorch-specific validation failures.
Do not load every reference preemptively, and do not depend on NVFLARE repository examples being present in the user's environment.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

