nvflare.client.config module

class ClientConfig(config: Dict | None = None)[source]

Bases: object

Config class used in nvflare.client module.

Note

The config has the following keys:

EXCHANGE_FORMAT: Format to exchange, pytorch, raw, or numpy
TRANSFER_TYPE: Either FULL or DIFF (means difference)
TRAIN_WITH_EVAL: Whether train task needs to also do evaluation
TRAIN_TASK_NAME: Name of the train task
EVAL_TASK_NAME: Name of the evaluate task
SUBMIT_MODEL_TASK_NAME: Name of the submit_model task
PIPE_CHANNEL_NAME: Channel name of the pipe
PIPE: pipe section
CLASS_NAME: Class name
ARG: Arguments
SITE_NAME: Site name
JOB_ID: Job id
TASK_EXCHANGE: TASK_EXCHANGE section
METRICS_EXCHANGE: METRICS_EXCHANGE section

Example

The content of config looks like:

{
  "METRICS_EXCHANGE": {
    "pipe_channel_name": "metric",
    "pipe": {
      "CLASS_NAME": "nvflare.fuel.utils.pipe.cell_pipe.CellPipe",
      "ARG": {
        "mode": "ACTIVE",
        "site_name": "site-1",
        "token": "simulate_job",
        "root_url": "tcp://0:51893",
        "secure_mode": false,
        "workspace_dir": "xxx"
      }
    }
  },
  "SITE_NAME": "site-1",
  "JOB_ID": "simulate_job",
  "TASK_EXCHANGE": {
    "train_with_eval": true,
    "exchange_format": "numpy",
    "transfer_type": "DIFF",
    "train_task_name": "train",
    "eval_task_name": "evaluate",
    "submit_model_task_name": "submit_model",
    "pipe_channel_name": "task",
    "pipe": {
      "CLASS_NAME": "nvflare.fuel.utils.pipe.cell_pipe.CellPipe",
      "ARG": {
        "mode": "ACTIVE",
        "site_name": "site-1",
        "token": "simulate_job",
        "root_url": "tcp://0:51893",
        "secure_mode": false,
        "workspace_dir": "xxx"
      }
    }
  }
}
get_config() Dict[source]
get_eval_task()[source]
get_exchange_format() str[source]
get_pipe_args(section: str) dict[source]
get_pipe_channel_name(section: str) str[source]
get_pipe_class(section: str) str[source]
get_submit_model_task()[source]
get_train_task()[source]
get_transfer_type() str[source]
to_json(config_file: str)[source]
class ConfigKey[source]

Bases: object

ARG = 'ARG'
CLASS_NAME = 'CLASS_NAME'
EVAL_TASK_NAME = 'eval_task_name'
EXCHANGE_FORMAT = 'exchange_format'
METRICS_EXCHANGE = 'METRICS_EXCHANGE'
PIPE = 'pipe'
PIPE_CHANNEL_NAME = 'pipe_channel_name'
SUBMIT_MODEL_TASK_NAME = 'submit_model_task_name'
TASK_EXCHANGE = 'TASK_EXCHANGE'
TASK_NAME = 'TASK_NAME'
TRAIN_TASK_NAME = 'train_task_name'
TRAIN_WITH_EVAL = 'train_with_eval'
TRANSFER_TYPE = 'transfer_type'
class ExchangeFormat[source]

Bases: object

NUMPY = 'numpy'
PYTORCH = 'pytorch'
RAW = 'raw'
class TransferType[source]

Bases: object

DIFF = 'DIFF'
FULL = 'FULL'
from_file(config_file: str)[source]
write_config_to_file(config_data: dict, config_file_path: str)[source]

Writes client api config file.

Parameters:
  • config_data (dict) – data to be updated.

  • config_file_path (str) – filepath to write.