nvflare.client.decorator module¶
- evaluate(_func=None, **root_kwargs)[source]¶
A decorator to wraps the evaluate logic.
Note
FLARE will pass the model received from the server side to the first argument of the decorated method. The return value of the decorated method needs to be a float number metric. The decorated method needs to be run BEFORE the training method, so the metrics will be sent along with the trained output model.
Usage:
@nvflare.client.evaluate def my_eval(input_model, device="cuda:0"): ... return metrics
- train(_func=None, **root_kwargs)[source]¶
A decorator to wraps the training logic.
Note
FLARE will pass the model received from the server side to the first argument of the decorated method. The return value of the decorated training method needs to be an FLModel object.
Usage:
@nvflare.client.train def my_train(input_model=None, device="cuda:0"): ... return new_model