nvflare.edge.tools.et_fed_buff_recipe module

class ETFedBuffRecipe(job_name: str, device_model: DeviceModel, input_shape, output_shape, model_manager_config: ModelManagerConfig, device_manager_config: DeviceManagerConfig, initial_ckpt: str | None = None, evaluator_config: EvaluatorConfig | None = None, simulation_config: SimulationConfig | None = None, device_training_params: Dict | None = None, custom_source_root: str | None = None, device_wait_timeout: float | None = None)[source]

Bases: EdgeFedBuffRecipe

Edge Training FedBuff Recipe for embedded/edge device training.

Recipe parameters and nested manager configuration values become part of the generated job definition and must never contain actual secrets. Read secrets from site environment variables or mounted files; references are supported only where documented in nvflare.recipe.secrets.

This recipe extends EdgeFedBuffRecipe for edge devices with DeviceModel wrapper.

Parameters:
  • job_name – Name of the federated learning job.

  • device_model – DeviceModel wrapping the PyTorch model for edge devices.

  • input_shape – Input shape for the model.

  • output_shape – Output shape for the model.

  • model_manager_config – Configuration for the model manager.

  • device_manager_config – Configuration for the device manager.

  • initial_ckpt – Absolute path to a pre-trained checkpoint file (.pt, .pth). The file may not exist locally (server-side path).

  • evaluator_config – Configuration for the global evaluator (optional).

  • simulation_config – Configuration for simulated devices settings (optional).

  • device_training_params – Training parameters for device (optional).

  • custom_source_root – Path to custom source code (optional).

  • device_wait_timeout – Timeout in seconds for waiting for sufficient devices to join before stopping the job. None means wait indefinitely. WARNING: when device_reuse=False with a finite device pool, leaving this as None can cause the job to hang indefinitely once the pool is exhausted. In that case, set an explicit timeout (e.g., 300.0 seconds). Default: None

This is base class of a recipe. Recipes are implemented by jobs. A concrete recipe must provide the job for recipe implementation.

Security contract – no secrets in recipe parameters:

Recipe parameters (train_args, task_args, eval_args, per_site_config, config overrides, dicts passed to add_client_config/add_server_config, exec params, etc.) can be written in clear text into generated job configuration. These parameters and their nested values must never contain actual passwords, API keys, tokens, private keys, or other credentials. Instead, read secrets from site environment variables or mounted secret files inside your code, or pass a placeholder created with nvflare.recipe.secrets.secret_ref() or nvflare.recipe.secrets.secret_file_ref() at a supported runtime boundary. See nvflare.recipe.secrets for the supported parameter locations.

Before export or run, recipes scan their parameters with heuristics and emit nvflare.recipe.secrets.PotentialSecretWarning when a value looks like an actual secret. The scan is best-effort: absence of a warning does not prove a parameter is safe to share.

Parameters:

job – the job that implements the recipe.

create_job()[source]

Create a new EdgeJob instance for cross-edge federated learning.

Returns:

A configured edge job instance

Return type:

EdgeJob