Hi @jayqi,
We’ve followed this guideline so far:
- Your code must use the intended Flower APIs for client–server communication. Your code must only use the provided client and server directories for saving and loading state. Any use of other I/O or global variables to pass information between calls is forbidden.
but it seems a bit confusing that in the example_src
, the model is stored (and updated) within the class instance, like so:
class TestClient(fl.client.NumPyClient):
"""Custom Flower NumPyClient class for test."""
def __init__(
self,
cid: str,
model: SirModel,
disease_outcome_df: pd.DataFrame,
preds_format_df: pd.DataFrame,
preds_path: Path,
):
super().__init__()
self.cid = cid
self.model = model
self.disease_outcome_df = disease_outcome_df
self.preds_format_df = preds_format_df
self.preds_path = preds_path
def evaluate(self, parameters: Parameters, config: dict) -> Tuple[float, int, dict]:
"""Make predictions on the test split. Use model parameters from server."""
set_model_parameters(self.model, parameters)
predictions = self.model.predict(self.disease_outcome_df)
predictions.loc[self.preds_format_df.index].to_csv(self.preds_path)
logger.info(f"Client test predictions saved to disk for client {self.cid}.")
# Return empty metrics. We're not actually evaluating anything
return 0.0, 0, {}
Could you clarify what this limitation means in terms of model storage in this example? If it applies only to communication/disk storage between client and server (or different clients), do we have to store the model to disk even within the same client (or server) class instance?
Additionally, if it’s allowed to reuse the same dynamic class instance variables between calls, we are wondering if we can reuse our Go process within the same class instance as well - this would save a lot of overhead we currently have on creating a new process on each call to the same client.
Thank you