flip.nvflare.components.pt_model_persistor

Classes

InitialCheckpointPTModelPersistor

Persistor that seeds the initial global model from a large backbone checkpoint

Module Contents

class flip.nvflare.components.pt_model_persistor.InitialCheckpointPTModelPersistor(model=None, model_id: str = '', **kwargs)

Bases: nvflare.app_opt.pt.file_model_persistor.PTFileModelPersistor

Persistor that seeds the initial global model from a large backbone checkpoint staged server-side, so the checkpoint never has to be bundled into the job app (bundling a ~759 MiB file collapses NVFLARE’s app-deploy to remote clients).

The backbone filename is declared in the job’s config.json under SERVER_CHECKPOINT. At load time it is resolved in this order:

  1. <app>/custom/<checkpoint> — a checkpoint bundled in the app. Used by the local simulator (which copies the file into custom/) and any legacy bundling.

  2. <SERVER_CHECKPOINT_ROOT>/<model_id>/<checkpoint> — the de-bundled checkpoint the FL API staged on the hub-local shared volume (production). Read straight from disk; the checkpoint is intentionally NOT shipped in the app bundle, so it never reaches the clients. Mirrors the Flower backend’s /app/src shared mount and the eval EvaluationPTModelLocator.

The resolved checkpoint is loaded (strict=False) into the get_model() architecture so the round-0 global model that ScatterAndGather broadcasts carries the backbone plus freshly-initialised heads — a full state dict the clients can load. Clients therefore build only a bare architecture and receive all weights at round 0; they need no checkpoint file.

When config.json declares no SERVER_CHECKPOINT (every other standard training job), this behaves exactly like the stock PTFileModelPersistor (initial weights from the model object), so it is a safe drop-in for the shared standard base app.

_model_id_arg = ''
_resolve_backbone(fl_ctx: nvflare.apis.fl_context.FLContext)

Locate the declared backbone checkpoint, or None if none is declared/found.

load_model(fl_ctx: nvflare.apis.fl_context.FLContext) nvflare.app_common.abstract.model.ModelLearnable