Are you seeing this error only in the federated learning setup or also in isolation without this utility?
EDIT: Could you post the current stack trace, please, as a small dummy model seems to work using your code (after removing the federated learning code).