nvflare.client.api module¶
- class ClientAPIType(value)[source]¶
Bases:
Enum
An enumeration.
- EX_PROCESS_API = 'EX_PROCESS_API'¶
- IN_PROCESS_API = 'IN_PROCESS_API'¶
- get_config() Dict [source]¶
Gets the ClientConfig dictionary.
- Returns:
A dict of the configuration used in Client API.
- init(rank: str | None = None)[source]¶
Initializes NVFlare Client API environment.
- Parameters:
rank (str) – local rank of the process. It is only useful when the training script has multiple worker processes. (for example multi GPU)
- Returns:
None
- is_evaluate() bool [source]¶
Returns whether the current task is an evaluate task.
- Returns:
True, if the current task is an evaluate task. False, otherwise.
- is_running() bool [source]¶
Returns whether the NVFlare system is up and running.
- Returns:
True, if the system is up and running. False, otherwise.
- is_submit_model() bool [source]¶
Returns whether the current task is a submit_model task.
- Returns:
True, if the current task is a submit_model. False, otherwise.
- is_train() bool [source]¶
Returns whether the current task is a training task.
- Returns:
True, if the current task is a training task. False, otherwise.
- log(key: str, value: Any, data_type: AnalyticsDataType, **kwargs)[source]¶
Logs a key value pair.
We suggest users use the high-level APIs in nvflare/client/tracking.py
- Parameters:
key (str) – key string.
value (Any) – value to log.
data_type (AnalyticsDataType) – the data type of the “value”.
kwargs – additional arguments to be included.
- Returns:
whether the key value pair is logged successfully
- receive(timeout: float | None = None) FLModel | None [source]¶
Receives model from NVFlare side.
- Returns:
An FLModel received.