·
Last changedVersion:
This version passed the hardening gate. Hardening applied 10 targeted changes and preserved all other text. Classified findings before hardening: 5. Classified findings closed: 0. Classified findings remaining: 5. Unclassified scanner findings remaining: 0. Review findings closed: 12. Review findings remaining: 0.
3
1
1
3
1
1
Expand | File | Group | Subtype | Severity | Status |
|---|---|---|---|---|---|
SKILL.md | Tool & MCP Manipulation | MCP configuration abuse | Medium | Open | |
BENCHMARK.md | Sensitive Data & Secret Exposure | Agent snooping | Medium | Open | |
evals/files/injection-hf/config.yaml | Sensitive Data & Secret Exposure | Data exfiltration | Medium | Open | |
evals/files/injection-hf/requirements.txt | Supply Chain & Install-Time Trust | Dependency or plugin compromise | Low | Open | |
SKILL.md | Tool & MCP Manipulation | MCP over-permissioning | Info | Open |
5 findings
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 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.
| Script | Purpose | Arguments |
|---|---|---|
| Resolve a local or Hub model/dataset snapshot and emit JSON evidence. | Identifier; required |
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>"])Without the download flag, the Hub invocation is a local cache only lookup and makes no network request or download; network access happens only with the download flag after explicit user authorization for that specific artifact. Pass a relative local identifier only when it resolves inside the inspected source root, and pass an absolute local path only when the user configured it or it appears in the inspected source, reporting it to the user. Any cache directory passed for an authorized download is the default cache or one the user specified.
../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.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.../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. Before any install, audit the dependency inputs, present the exact package list with any embedded credentials redacted, report unpinned or unfamiliar requirements, and get explicit user confirmation; leave the install target to the existing host interpreter rule.
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.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.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.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, limited to files inside the inspected source project or files the user explicitly confirms; list every packaged file outside the project before export and keep home dot directories, credential stores, and system directories out of the package. 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().../nvflare-shared/references/validation-evidence.md
and references/huggingface-validation.md. Follow the shared compile,
construction, simulation, and terminal-evidence ladder. Before the simulation rung, tell the user that it runs their repository training code with the agent's privileges and get explicit user confirmation; prefer an isolated environment that holds only the credentials and network access the user authorized. Compile and construction rungs may run first. 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.../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. Keep exact artifact paths, and redact credentials, hostnames, sample data rows, and private dataset contents from any quoted log excerpt.flare.patch(trainer) as the sole model-exchange owner. receive()
inside a patched loop may inspect task metadata only; it must not load a
second copy of the global model.../nvflare-shared/references/conversion-common.md. Keep the generated client
rankless; nvflare.client.hf.init() owns distributed-rank resolution and
rejection. Load references/huggingface-state-and-distributed.md only for a
distributed multi-process source path.trainer.evaluate() before trainer.train() on every rank.
Do not invent compute_metrics, label mappings, averaging denominators, or
metric direction.../nvflare-shared/references/pytorch-family-recipe-construction.md; the
Hugging Face delta is only how the delivered key is named and produced. Must
preserve source metric names when practical: if the generated
trainer.evaluate() emits accuracy, set key_metric="accuracy"; if Trainer
emits a prefixed key such as eval_accuracy, set the server to that exact key
and report the source-to-server mapping. When best-model selection is
requested, every lower-is-better metric, including Trainer-generated
eval_loss, is delivered as an explicitly negated companion and selected by
that key — never as raw loss. When selection is not requested, use
key_metric=""; do not omit it and accidentally activate the recipe default.trainer.model owns all federated trainable state for
Trainer subclasses with reference, reward, value-head, or other auxiliary
models. Ask or fail closed when params_scope="auto" would omit trainable
state required by the algorithm.../nvflare-shared/references/pytorch-model-exchange.md (State-Dict
Compatibility). Ask one semantic question or fail closed when required values
are not statically available.restore_state=True.TrainingArguments.max_steps budget for a length-less
iterable training dataset and let flare.patch(trainer) infer it.save_only_model=True with
restore_state=True, load_best_model_at_end=True, prebuilt
optimizer/scheduler instances with restore_state=False, and checkpoint paths
not visible to every distributed rank. Do not rewrite these settings silently.
launch_once is a framework-neutral recipe parameter owned by
../nvflare-shared/references/pytorch-family-recipe-construction.md; the
Hugging Face delta is only that the product rejects explicit
launch_once=False together with restore_state=True.torch.distributed before patching when rank environment
variables declare multiple ranks. All ranks must call patched Trainer methods
in identical order.trust_remote_code=True, download model/data
artifacts unless requested, or recover from a cache-only miss by going
online. Cache misses, remote identifiers, and validation requests do not
authorize online retries; see ../nvflare-shared/references/conversion-common.md.
Take the Hub repository and revision from the user or confirm them with the
user, and report the repository and full commit revision before an authorized
download. Report when a resolved snapshot holds pickle based weight files
rather than safetensors files, and get user acceptance before loading them.
Use ambient Hub credentials or cached logins only for repositories the user
authorized, and keep tokens, token file locations, and auth headers out of
logs, resolver evidence, generated job code, and the final report.../nvflare-shared/references/conversion-common.md.Always read this converter SKILL.md together with ../nvflare-shared/references/conversion-common.md. Complete each workflow phase before loading the next phase's reference.
Do not preload validation, state/DDP, broad workflow, dependency, or reporting references. The standard FedAvg path loads, in order:
../nvflare-shared/references/conversion-common.md, references/huggingface-detection.md, and ../nvflare-shared/references/site-data-and-paths.md only for its stated triggers;
../nvflare-shared/references/pytorch-family-recipe-construction.md, references/huggingface-conversion.md, and ../nvflare-shared/references/pytorch-model-exchange.md;
then ../nvflare-shared/references/validation-evidence.md and references/huggingface-validation.md; load references/huggingface-state-and-distributed.md and other shared references only under the triggers above. Do not depend on repository examples.
Get started with chainctlchainctl skill install public/nvidia/nvflare-convert-huggingface:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.chainreg.biz/public/github.com/nvidia/skills/nvflare-convert-huggingface:latest
Apache-2.0
BENCHMARK.md
HARDENING.md
SKILL.md
assets/client_with_eval.py
assets/job.py
assets/server_model.py
evals/config.yml
evals/evals.json
evals/files/SOURCE.md
evals/files/external-data-hf/model.py
evals/files/external-data-hf/train.py
evals/files/factory-distributed/model.py
evals/files/factory-distributed/train.py
evals/files/factory-evaluated/model.py
evals/files/factory-evaluated/train.py
evals/files/factory-peft-sft/model.py
evals/files/factory-peft-sft/train.py
evals/files/factory-train-only/model.py
evals/files/factory-train-only/train.py
evals/files/injection-hf/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/peft-sft/model.py
evals/files/peft-sft/train.py
evals/files/relative-data-hf/model.py
evals/files/relative-data-hf/train.py
evals/files/trainer-basic/model.py
evals/files/trainer-basic/train.py
references/huggingface-conversion.md
references/huggingface-detection.md
references/huggingface-state-and-distributed.md
references/huggingface-validation.md
scripts/resolve_model_snapshot.py
skill-card.md
skill.oms.sig
tests/helper_scripts.md