nvflare.app_common.np.utils module
Utility functions for numpy model handling.
- load_numpy_model(fl_ctx: FLContext, logger: object, source_ckpt_file_full_name: str | None, model_file_path: str, get_fallback_data: Callable[[], ndarray]) ndarray[source]
Load numpy model with fallback priority.
This utility function provides shared loading logic for numpy model persistors. It loads model data with the following priority: 1. source_ckpt_file_full_name (if provided and exists) 2. model_file_path (previously saved model) 3. fallback_data (from get_fallback_data callback)
- Parameters:
fl_ctx – FLContext for logging.
logger – Logger object with log_info, log_warning methods (typically the persistor).
source_ckpt_file_full_name – Full path to source checkpoint file (may not exist locally).
model_file_path – Path to saved model file.
get_fallback_data – Callable that returns fallback numpy array.
- Returns:
Loaded model data.
- Return type:
np.ndarray