flip.nvflare.executors.trainer

RUN_TRAINER Executor.

This module provides the RUN_TRAINER executor that wraps user-provided FLIP_TRAINER classes with error handling.

Classes

RUN_TRAINER

Wrapper executor that runs user-provided FLIP_TRAINER implementations.

Module Contents

class flip.nvflare.executors.trainer.RUN_TRAINER(train_task_name=AppConstants.TASK_TRAIN, submit_model_task_name=AppConstants.TASK_SUBMIT_MODEL, exclude_vars=None, project_id='', query='')[source]

Bases: nvflare.apis.executor.Executor

Wrapper executor that runs user-provided FLIP_TRAINER implementations.

This executor handles: - Dynamic importing of the user’s FLIP_TRAINER class - Error handling and exception logging - Lazy initialization of the trainer instance

Initialize the RUN_TRAINER executor.

Parameters:
  • train_task_name – Task name for train task. Defaults to “train”.

  • submit_model_task_name – Task name for submit model. Defaults to “submit_model”.

  • exclude_vars – List of variables to exclude during model loading.

  • project_id – The ID of the project the model belongs to.

  • query – The cohort query that is associated with the project.

execute(task_name: str, shareable: nvflare.apis.shareable.Shareable, fl_ctx: nvflare.apis.fl_context.FLContext, abort_signal: nvflare.apis.signal.Signal) nvflare.apis.shareable.Shareable[source]

Execute the training task.

This method: 1. Lazily imports and initializes the user’s FLIP_TRAINER 2. Delegates execution to the user’s trainer 3. Catches and reports any exceptions

Parameters:
  • task_name – The name of the task to execute

  • shareable – The input shareable data

  • fl_ctx – The FL context

  • abort_signal – Signal for aborting the task

Returns:

Shareable – The result of the training task