Checkpoints¶
When creating a new VFL training session, you can pass a previous training session ID and round ID as a checkpoint. The model will be loaded from this checkpoint for the new training session.
You can also download round-specific model coefficients through the SDK interface. Coefficients are saved to the federated server after each round in addition to at the end of a session.
Run a session to determine a checkpoint of interest¶
checkpoint_vfl_train_session = client.create_vfl_session(
name="Testing checkpointing in VFL",
description="Running a VFL train session to find a checkpoint",
prl_session_id=prl_session.id, # must be a succesful PRL session ID that matches the datasets used in this session
vfl_mode="train",
min_num_clients=2,
num_rounds=num_rounds,
package_name="VflGlm",
data_config=data_config,
model_config=model_config,
).start()
checkpoint_vfl_train_session.id
Get metrics for the session
metrics = checkpoint_vfl_train_session.metrics().as_dict()
metrics
Start a new session from a checkpoint¶
To start a new session from a previous checkpoint, specify the training_session_id and the training_round_id from the previous session of interest.
Example:
vfl_train_session = client.create_vfl_session(
name="VFL train session with checkpoint",
description="vfl train session with checkpoint",
prl_session_id=prl_session.id,
training_session_id=checkpoint_vfl_train_session.id,
training_round_id=2,
vfl_mode="train",
min_num_clients=2,
num_rounds=num_rounds,
package_name="VflGlm",
data_config=data_config,
model_config=model_config,
).start()
vfl_train_session.id
Using best training model for prediction¶
You can pass a desired model round ID from a successful VFL train session to be used as a starting point in a VFL predict session. This enables you to run predict session with the best model from training.
Example:
vfl_predict_session = client.create_vfl_session(
name="Prediction from best trained model",
description="Using a specific model round from training to perform a prediction.",
prl_session_id=prl_session.id,
training_session_id=vfl_train_session.id, #specify the training session ID
training_round_id=2, #specify the round ID of the best training model
vfl_mode="predict",
data_config=data_config,
).start()
vfl_predict_session.id