Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in Client and NumPyClient tutorial #1710 #1711

Conversation

techwizrd
Copy link
Contributor

In Step 2, replace config with ins.config in evaluate() and ensure simulation is calling the client_fn corresponding to the Client-based client.

Reference Issues/PRs

Fixes #1710

What does this implement/fix? Explain your changes.

This PR fixes several typos in Step 2: Moving from NumPyClient to Client of the Client and NumPyClient tutorial.

  1. When defining the fit() function for Client, it uses ins.config but the evaluate function erroneously uses just config:
    def evaluate(self, ins: EvaluateIns) -> EvaluateRes:
        print(f"[Client {self.cid}] evaluate, config: {config}")

This leads to a NameError:

    print(f"[Client {self.cid}] evaluate, config: {config}")
NameError: name 'config' is not defined

This PR fixes the NameError by replacing config with ins.config.

  1. Additionally, the tutorial asks the user to run the example using the new Client-based client, but the simulation calls numpyclient_fn instead of client_fn.
fl.simulation.start_simulation(
    client_fn=numpyclient_fn,
    num_clients=2,
    config=fl.server.ServerConfig(num_rounds=3),
    client_resources=client_resources,
)

This simulation will run the NumPyClient-based client rather than the new Client-based client. This PR fixes this by replacing the call to numpyclient_fn with client_fn.

Any other comments?

In Step 2, replace config with ins.config in evaluate() and ensure
simulation is calling the client_fn corresponding to the Client-based
client.
techwizrd and others added 2 commits March 15, 2023 01:08
There are some minor typos where config and numpyclient_fn are used
instead of ins.config and client_fn.
Copy link
Member

@tanertopal tanertopal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good to me!

@tanertopal
Copy link
Member

Thank you for your contribution @techwizrd

@tanertopal tanertopal merged commit fffb31d into adap:main Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix typos in Client and NumPyClient tutorial
3 participants