nvflare-convert-huggingface
Convert existing Hugging Face Transformers Trainer or TRL SFTTrainer training code into an NVFLARE federated job using flare.patch(trainer), local validation…
Skill by NVIDIA FLARE Team <federatedlearning@nvidia.com>
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/nvidia-nvflare-convert-huggingface
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml, refactoring
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/nvflare-convert-huggingface
What's inside
- Skill name
nvflare-convert-huggingface- Description
- Convert existing Hugging Face Transformers Trainer or TRL SFTTrainer training code into an NVFLARE federated job using flare.patch(trainer), local validation, and job export; use when the user names Hugging Face or preliminary source inspection identifies one Hugging Face owner, and not for manual PyTorch loops, Lightning, inference-only pipelines, deployment, or experiment workflows.
- License
- Apache-2.0
- Metadata
- tags: nvflare, federated-learning, huggingface, transformers, trl, peft, conversion · author: NVIDIA FLARE Team <federatedlearning@nvidia.com> · domain: ml · version: 0.1.0 · category: Conversion · languages: python · frameworks: huggingface, transformers, trl, pytorch, nvflare · blast-radius: runs_simulator · min-flare-version: 2.9.0
- Instructions
- 185 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (38)
- BENCHMARK.md
- SKILL.md
- client_with_eval.py · assets/
- job.py · assets/
- server_model.py · assets/
- evals.json · evals/
- SOURCE.md · evals/files/
- model.py · evals/files/external-data-hf/
- train.py · evals/files/external-data-hf/
- model.py · evals/files/factory-distributed/
- train.py · evals/files/factory-distributed/
- model.py · evals/files/factory-evaluated/
- train.py · evals/files/factory-evaluated/
- model.py · evals/files/factory-peft-sft/
- train.py · evals/files/factory-peft-sft/
- model.py · evals/files/factory-train-only/
- train.py · evals/files/factory-train-only/
- DATASET_CARD.md · evals/files/injection-hf/
- MODEL_CARD.md · evals/files/injection-hf/
- README.md · evals/files/injection-hf/
- config.yaml · evals/files/injection-hf/
- model.py · evals/files/injection-hf/
- requirements.txt · evals/files/injection-hf/
- train.py · evals/files/injection-hf/
- model.py · evals/files/peft-sft/
- train.py · evals/files/peft-sft/
- model.py · evals/files/relative-data-hf/
- train.py · evals/files/relative-data-hf/
- model.py · evals/files/trainer-basic/
- train.py · evals/files/trainer-basic/
- huggingface-conversion.md · references/
- huggingface-detection.md · references/
- huggingface-state-and-distributed.md · references/
- huggingface-validation.md · references/
- resolve_model_snapshot.py · scripts/
- skill-card.md
- skill.oms.sig
- helper_scripts.md · tests/
SKILL.md (first lines)
# NVFLARE Convert Hugging Face
## Use When
Use when converting training code built around `transformers.Trainer`, `Seq2SeqTrainer`,
TRL `SFTTrainer`, or another Trainer subclass. Support full-model and PEFT/LoRA
fine-tuning, datasets/tokenizers, Trainer callbacks and metrics, checkpoint continuity,
and replicated `torch.distributed` training.
## Do Not Use When
Do not use for an `AutoModel` driven by a manual PyTorch loop without a
Hugging Face Trainer (route to `nvflare-convert-pytorch`), PyTorch Lightning
(route to `nvflare-convert-lightning`, including Lightning modules that contain
Transformers models), inference-only pipelines, model serving, failed jobs
(route to `nvflare-diagnose-job`), or federated statistics without training
(route to `nvflare-fed-stats`). Route a project with active Lightning and
Hugging Face Trainer entrypoints to `nvflare-orient` to select one training-loop
owner or separate jobs. Route unresolved Trainer ownership, such as a Trainer
factory without a bound owner call, to `nvflare-orient`; do not patch either Trainer.
Out of scope: DeepSpeed, FSDP, production/POC deployment, controller rewrites,
experiment search, and privacy-protection requests such as HE, encrypted
aggregation, differential privacy, or privacy filters; never substitute an
unprotected recipe or present a disclaimer as implementation.
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.
## Available Scripts
| Script | Purpose | Arguments |
| --- | --- | --- |
| `scripts/resolve_model_snapshot.py` | Resolve a local or Hub model/dataset snapshot and emit JSON evidence. | Identifier; required `--source`; optional source-root, download, revision, cache, and repository-type flags. |
Use `run_script()` only during the validation phase after loading `references/huggingface-validation.md`. For example:
- `run_script("scripts/resolve_model_snapshot.py", ["--source", "local", "--source-root", "<absolute-source-root>", "<configured-path>"])`
- `run_script("scripts/resolve_model_snapshot.py", ["--source", "hub", "<org/model>"])`
## Workflow
1. Load `../nvflare-shared/references/conversion-common.md` and apply it for the
whole conversion; this SKILL.md states only the framework-specific deltas.
Load `../nvflare-shared/references/conversion-workflow.md` only for a non-standard
rerun, authorization, or missing-semantics case; it no longer holds the
data-location or partitioning contracts, whose invariants `conversion-common.md`
owns. Load `../nvflare-shared/references/site-data-and-paths.md` for generated
partitions, relative paths, or per-site data locations.
2. Inspect before editing with `nvflare agent inspect source <path> --format json`
plus direct source reading. Load `references/huggingface-detection.md` during
this phase. If inspect recommends `nvflare-orient` for unresolved Trainer
ownership or active Lightning/Hugging Face owners, stop before editing.
Extract the entrypoint, Trainer subclass, model constructor, tokenizer or
processor, datasets and collator, Trainer arguments, `compute_metrics`,
callbacks, checkpoint and PEFT settings, precision, local budget,
distributed launcher, site/round counts, data location, and aggregation
intent. Do not import or execute user training modules to discover them.
3. Apply the dependency-install ordering rule in `../nvflare-shared/references/conversion-common.md` before any Python command imports user, framework, NVFLARE, or declared dependencies. Keep dependency inventory single-purpose: check NVFLARE separately, inventory non-product packages separately, and do not append Hugging Face cache or filesystem discovery.
Defer model and dataset availability checks to the maintained resolver during validation. If an optional path must be inspected, run it separately and report a missing directory with exit code zero.
4. Select the recipe from FL intent. For explicit FedAvg, run `nvflare recipe
show fedavg-pt --format json`, then immediately load
`../nvflare-shared/references/pytorch-family-recipe-construction.md` and use
the returned module, class, and parameters with the required construction
and execution shape in `assets/job.py`. Import `FedAvgRecipe` from
`nvflare.app_opt.pt.recipes.fedavg`, never from `nvflare.recipe`. Treat
`class_path` as the public recipe key and `path` as its normalized exported
representation; do not inspect Recipe source or signatures to reconcile
them. Do not guess adjacent symbols or add per-site recipe config unless
sites genuinely differ. Load
`../nvflare-shared/references/pytorch-family-recipe-selection.md` only for
ambiguous, evaluation-only, or non-FedAvg requests.
5. Convert with `references/huggingface-conversion.md` and adapt
`assets/client_with_eval.py` rather than drafting a new round loop. Preserve
model, tokenizer/processor, datasets, collator, Trainer arguments,
callbacks, and metrics. Apply the step-1 data-location rules to the client's
data argument. Import the Client API as `import nvflare.client.hf as flare`,
so `flare.init()`,
`flare.patch()`, and `flare.is_running()` resolve to `nvflare.client.hf`. Keep
`flare.patch(trainer)` simple with inferred `params_scope="auto"` and encode
one per-round budget in
Trainer arguments: requested steps use `max_steps`, requested epochs use
`num_train_epochs`, and a silent prompt uses the reported default
`max_steps=10` unless source-budget preservation was requested. Do not
duplicate the budget in patch `local_steps`/`local_epochs`. When the client
uses `HfArgumentParser`, construct it with `allow_abbrev=False`.
6. Adapt `assets/server_model.py` and `assets/job.py` instead of inventing
server-model, packaging, export, or `SimEnv` wiring. Keep generated and
packaged project-local modules in the same writable source directory. Never
use `..` in `train_script`, `add_server_file()`, or `add_client_file()`; use
an existing resolved absolute path when co-location is impossible. Keep the
server and Trainer model factory and exchange keyspace identical. Use the
recipe's documented `class_path` or `path` key plus complete `args` for
required or overridden values; a direct zero-argument instance must not use
`from_pretrained()`, downloads, or
checkpoint loading during job construction. Apply only options confirmed by
the construction reference. Preserve the job asset's recipe-before-parser
ordering, `ArgumentParser(allow_abbrev=False)`, and strict `parse_args()`; do
not use `parse_known_args()`.
7. Only after generated files exist, load `../nvflare-shared/references/validation-evidence.md`
and `references/huggingface-validation.md`. Follow the shared compile,
construction, simulation, and terminal-evidence ladder. Inspect export/package
evidence only for an exported final target;
inspect a local target's materialized evidence after its run. Apply only the
standard HF Trainer checks and stop at the first failed rung. Review and exercise
the maintained assets directly; do not inspect NVFLARE implementation source,
improvise Recipe API probes, or write one-off AST programs to re-prove them. Use
`references/huggingface-state-and-distributed.md`
only when inspection found PEFT, DDP, checkpoint/restore overrides,
auxiliary trainable models, or another non-default patch setting.
8. Report the recipe, source facts, parameter scope, data partition, changed
files, validation status, and exact artifact paths. When validation produces
metrics, load `../nvflare-shared/references/metrics-and-artifact-reporting.md`
before the final response and report each observed primary scalar with its
metric name, numeric value, and artifact or bounded-log source.
## Requirements
- Must use `flare.patch(trainer)` as the sole model-exchange owner. `receive()`From NVIDIA/skills, Apache-2.0.
More from NVIDIA/skills
- 0.846score
nemo-fabric-integrate
NVIDIA Corporation and Affiliates
Use this skill when integrating NVIDIA NeMo Fabric into a consumer application, service, evaluation harness, or platform through the typed Python SDK —…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
jetson-video-pipeline
Vinit Bansal <vinitkumarb@nvidia.com>
Use when planning, executing, and independently validating Jetson Video Codec SDK or PyNvVideoCodec encode/decode, transcode, segmentation, container decode…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-convert-pytorch
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Convert existing plain or manual PyTorch training code into an NVFLARE federated job using Client API model exchange, local validation, and job export; use…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nemo-relay-get-started
NVIDIA Corporation and Affiliates
Use this skill when first-time NeMo Relay users want help selecting and following an appropriate quick-start guide or verifying their first working integration.
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
jetson-video-recipe
Vinit Bansal <vinitkumarb@nvidia.com>
Use when turning a Jetson encoder use case into one surface-neutral recipe with native Video Codec SDK and PyNvVideoCodec projections.
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvidia-broadcast
NVIDIA Broadcast Team <broadcast-skills-dev@nvidia.com>
Use when controlling NVIDIA Broadcast through MCP to apply effects, process local media, select devices, or change camera resolution, or when Broadcast is…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
jetson-video-setup
Vinit Bansal <vinitkumarb@nvidia.com>
Use when installing, repairing, reusing, inspecting, or verifying readiness of the native NVIDIA Video Codec SDK or PyNvVideoCodec on Jetson, including the…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-diagnose-job
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Use when the user asks why a reported NVFLARE job failure signal occurred: the job failed, stalled, timed out, lost clients, ended with EXECUTION_EXCEPTION…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-convert-lightning
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nemo-relay-install
NVIDIA Corporation and Affiliates
Use this skill when choosing or running NeMo Relay installation for an agent runtime, application language, framework integration, or plugin bundle, or…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-fed-stats
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Compute federated statistics over tabular data (count, sum, mean, stddev, var, histogram, quantile, noise-protected min/max) and image data (count…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
jetson-video-capability
Vinit Bansal <vinitkumarb@nvidia.com>
Use when Jetson codec, profile, chroma, bit-depth, dimension, engine-count, or operational support must be reconciled from live APIs, authenticated NVIDIA…
SkillAFreshness: A★ 3.7KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 3,718
- Forks
- 457
- Open issues
- 8
- Last commit (this folder)
- Sep 13, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.1.0
- License
- Apache-2.0
- Repository
- github.com/NVIDIA/skills
- Website
- docs.nvidia.com/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from NVIDIA FLARE Team <federatedlearning@nvidia.com>
- 0.846score
nvflare-fed-stats
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Compute federated statistics over tabular data (count, sum, mean, stddev, var, histogram, quantile, noise-protected min/max) and image data (count…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-diagnose-job
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Use when the user asks why a reported NVFLARE job failure signal occurred: the job failed, stalled, timed out, lost clients, ended with EXECUTION_EXCEPTION…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-convert-pytorch
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Convert existing plain or manual PyTorch training code into an NVFLARE federated job using Client API model exchange, local validation, and job export; use…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.846score
nvflare-convert-lightning
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Convert existing PyTorch Lightning training code into an NVFLARE federated job using the Lightning Client API patch, local validation, and job export; use…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.842score
nvflare-orient
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Route open-ended NVFLARE advice and only conversion requests whose preliminary source inspection reports unresolved or conflicting ownership; never load this…
SkillAFreshness: A★ 3.7KClaude Code +9 - 0.796score
nvflare-shared
NVIDIA FLARE Team <federatedlearning@nvidia.com>
Internal NVFLARE conversion references and templates.
SkillBFreshness: B★ 3.7KClaude Code +9
Cite this page
nvflare-convert-huggingface skill. Agent Mart. https://agentmart.dev/skills/nvidia-nvflare-convert-huggingface (last updated 2026-10-24)