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

refactor: use alexnet to replace efficientnet #2782

Merged
merged 16 commits into from
Jan 24, 2024

Conversation

helin0815
Copy link
Contributor

@helin0815 helin0815 commented Jan 9, 2024

Issue

Description

Proposal

Explanation

Changelog entry

Any other comments?

@jafermarq
Copy link
Contributor

Hi @helin0815, I think instead of removing efficientnet what we can do is have both models and then let the user decide which one to use. For that, you can introduce a new argument to argparse (both for server and clients) and then do if/else and load the appropriate model. Does it sound good?

@jafermarq jafermarq added the Examples Add or update a Flower example label Jan 17, 2024
@helin0815
Copy link
Contributor Author

@jafermarq good.The problem I am currently facing is that if using Efficientnet, adding a little bit of noise during differential privacy noise addition can cause loss to become nan. When I try using Alexnet, I can add noise normally and I will add this part to Readme

@helin0815
Copy link
Contributor Author

@jafermarq hello,please review again.

Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

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

Hi @helin0815,

I updated your branch with the latest main. I had to fix some merge conflicts because we recently updated the advanced-pytorch example. I also did some small modifications to how --model used.

Currently your example with --model alexnet doesn't work because the CIFAR-10 batches are of shape 224x224 but your model expects them to be 32x32... I'll get back to you about this early in the week. maybe it's a good idea to update the example to user 32x32.

In the mean time, could you update the README and show how people using the example can change the model?

examples/advanced-pytorch/README.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@helin0815 helin0815 left a comment

Choose a reason for hiding this comment

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

lgtm

@helin0815
Copy link
Contributor Author

@jafermarq hello bro,I just deleted the differential privacy related section in readme. What should I do next

@jafermarq
Copy link
Contributor

@jafermarq hello bro,I just deleted the differential privacy related section in readme. What should I do next

I pushed with some changes. The main one is replacing alexnet.py with the model that torchvision.models.AlexNet provides. The reason for this is that this example is ready for 224x224 inputs (as opposed to 32x32, which is what the model in alexnet.py expected).

I added a couple of sentences at the end of the reamde to indicate how people can switch between efficientnet/alexent. Please take a look. Something else to include?

jafermarq
jafermarq previously approved these changes Jan 24, 2024
Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

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

@helin0815 , Thanks for the additions to this example. This will be useful for users that want to see how easy it is to switch between ML models for Flower clients. 💯

@jafermarq jafermarq enabled auto-merge (squash) January 24, 2024 13:50
@jafermarq jafermarq merged commit 88f2e3e into adap:main Jan 24, 2024
28 checks passed
@helin0815
Copy link
Contributor Author

@jafermarq Thank you for submitting the code and modifying the readme so that this PR can be merged smoothly. When you last replied to me, I was already asleep. In China, this is my sleeping time. I hope this PR can be helpful to other flower users. Thank you for your efforts

@helin0815 helin0815 deleted the refactor/alexnet_model branch January 25, 2024 01:21
@helin0815 helin0815 restored the refactor/alexnet_model branch January 25, 2024 01:26
@helin0815 helin0815 deleted the refactor/alexnet_model branch January 25, 2024 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Examples Add or update a Flower example
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants