nvflare.job_config.script_runner module

class FrameworkType[source]

Bases: object

NUMPY = 'numpy'
PYTORCH = 'pytorch'
RAW = 'raw'
TENSORFLOW = 'tensorflow'
class ScriptRunner(script: str, script_args: str = '', launch_external_process: bool = False, command: str = 'python3 -u', framework: FrameworkType = 'pytorch', params_transfer_type: str = 'FULL')[source]

Bases: object

ScriptRunner is used with FedJob API to run or launch a script.

in-process launch_external_process=False uses InProcessClientAPIExecutor (default). ex-process launch_external_process=True uses ClientAPILauncherExecutor.

Parameters:
  • script (str) – Script to run. For in-process must be a python script path. For ex-process can be any script support by command.

  • script_args (str) – Optional arguments for script (appended to script).

  • launch_external_process (bool) – Whether to launch the script in external process. Defaults to False.

  • command (str) – If launch_external_process=True, command to run script (preprended to script). Defaults to “python3”.

  • framework (str) – Framework type to connfigure converter and params exchange formats. Defaults to FrameworkType.PYTORCH.

  • params_transfer_type (str) – How to transfer the parameters. FULL means the whole model parameters are sent. DIFF means that only the difference is sent. Defaults to TransferType.FULL.

add_to_fed_job(job, ctx, **kwargs)[source]

This method is used by Job API.

Parameters:
  • job – the Job object to add to

  • ctx – Job Context

Returns: