nvflare.app_common.np.np_model_locator module

class NPModelLocator(model_dir='models', model_name: str | Dict[str, str] = 'server.npy')[source]

Bases: ModelLocator

The ModelLocator’s job is to find the models to be included for cross site evaluation located on server. This NPModelLocator finds and extracts “server” model that is saved during training.

Parameters:
  • model_dir (str) – Directory to look for models in. Defaults to “model”

  • model_name (Union[str, Dict[str, str]]) – model names and locations

SERVER_MODEL_NAME = 'server'
get_model_names(fl_ctx: FLContext) List[str][source]

Returns the list of model names that should be included from server in cross site validation.add()

Parameters:

fl_ctx (FLContext) – FL Context object.

Returns:

List of model names.

Return type:

List[str]

locate_model(model_name, fl_ctx: FLContext) DXO[source]

Locate a single model by its name.

Parameters:
  • model_name (str) – Name of the model.

  • fl_ctx (FLContext) – FL Context object.

Returns:

a DXO object

Return type:

DXO