-
Notifications
You must be signed in to change notification settings - Fork 31
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
update server/client/model interfaces #15
Conversation
audio_demo/index.js, line 81 at r1 (raw file):
This is still awkward -- although it's nice to be able to access the underlying Comments from Reviewable |
audio_demo/index.js, line 92 at r1 (raw file):
Instead of calling const serverURL = 'http://foo.bar';
const model = new AudioTransferLearningModel();
const api = new ClientAPI(model, serverURL);
api.setup().then(() => {
// rest of logic
}); Comments from Reviewable |
src/client/comm.ts, line 131 at r1 (raw file):
Interested in feedback on the idea laid out in this comment -- might be a nice way of delaying updates until we get sufficient data without forcing the user to deal with that complexity. Not sure what the best way to transmit that configuration is, though. Comments from Reviewable |
src/client/comm.ts, line 140 at r1 (raw file):
One thing I realized while writing this is that Comments from Reviewable |
Review status: 0 of 1 LGTMs obtained audio_demo/index.js, line 81 at r1 (raw file): Previously, asross (Andrew Ross) wrote…
You could cleanly do this as fedModel.setup().then(async ({ model }) => {
...
}) Or fedModel.setup().then(async ({ model: unwrappedModel }) => { etc src/client/comm.ts, line 131 at r1 (raw file): Previously, asross (Andrew Ross) wrote…
Does reverting to the same weights give us better loss (e.g so that the clients don't diverge too much if the syncs are slow/don't run ahead of each other too much)? Does this also mean if a user is sufficiently multimodal data (w/ modality correlated with time) a single user gets to act as multiple clients. src/client/comm.ts, line 140 at r1 (raw file): Previously, asross (Andrew Ross) wrote…
Perhaps if we keep needing to add things like this it might be worth creating a src/client/comm.ts, line 167 at r1 (raw file):
Minor (very minor) : try Comments from Reviewable |
This is really nice simplification! Left a few comments. Feel free to come chat in person (much faster) if you have any questions Reviewed 7 of 8 files at r1. audio_demo/index.js, line 81 at r1 (raw file): Previously, aman-tiwari (Aman Tiwari) wrote…
Require that the user passes a tf.Model in the c-tor of audio_demo/index.js, line 92 at r1 (raw file): Previously, asross (Andrew Ross) wrote…
This is really nice - removes the need for 2 setup() calls. I would do src/comm_test.ts, line 111 at r1 (raw file):
instead of reading the src/comm_test.ts, line 147 at r1 (raw file):
Now that you have src/types.ts, line 25 at r1 (raw file):
let's add some short jsdocs to these methods , since this is public api. src/client/comm.ts, line 55 at r1 (raw file):
how about renaming DownloadMsg to ClientUpdateMsg to be more explicit? src/client/comm.ts, line 59 at r1 (raw file):
make this src/client/comm.ts, line 131 at r1 (raw file): Previously, aman-tiwari (Aman Tiwari) wrote…
Let's leave it for now (Having the TODO there is great). Finding the right balance between magic vs user-control will be easier to find once we have a few experiments. src/client/comm.ts, line 140 at r1 (raw file): Previously, aman-tiwari (Aman Tiwari) wrote…
If I understand correctly, Comments from Reviewable |
Review status: 0 of 1 LGTMs obtained src/client/comm.ts, line 55 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
So... in the changes I just pushed up, I ended up doubling down(loads); i.e. changing src/client/comm.ts, line 131 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
@aman-tiwari yep -- reverting to the same weights means that one user gets to act as multiple clients, which is already true on the server side. If we didn't revert, then users would be sending us multiple updates for the same data points, and the first data point they happened to see would be overemphasized relative to the last one. There are compelling reasons against reverting too; e.g. if server downloads are few and far between, and we want clients to improve locally in the interim. But there are potential downsides too. I summarized some of the pros and cons in #7. Comments from Reviewable |
src/serialization.ts, line 68 at r2 (raw file):
I ended up renaming Comments from Reviewable |
Review status: 0 of 1 LGTMs obtained src/types.ts, line 30 at r2 (raw file):
Part of me wants to rename const model = await tf.loadModel(url);
const fedModel = Federated(model); But that might be too cute / less clear. Comments from Reviewable |
Reviewed 1 of 8 files at r1, 9 of 11 files at r2, 2 of 2 files at r3. src/serialization.ts, line 68 at r2 (raw file): Previously, asross (Andrew Ross) wrote…
Sounds good. src/types.ts, line 30 at r2 (raw file): Previously, asross (Andrew Ross) wrote…
Not for this PR: I can imagine having a free-floating function import * as client from '@tensorflow/federated-client';
const clientApi = client.fromTFModel(model);
// The intermediate FederatedTFModel object is not exposed.
... src/client/comm.ts, line 55 at r1 (raw file): Previously, asross (Andrew Ross) wrote…
Sounds good! +1 to having consistency between the type and the subscribing method name, src/client/comm.ts, line 57 at r3 (raw file):
no need for closure style annotation (remove Comments from Reviewable |
Review status: src/types.ts, line 30 at r2 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Yep, that would work well! In the next PR I modified the client/server APIs to take either a src/client/comm.ts, line 57 at r3 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Sounds good. Will fix in next PR to avoid merge conflicts (which will be arriving just after this gets merged) Comments from Reviewable |
This is a WIP pull request is relative to the
audio
branch, which will definitely break the MNIST and CIFAR experiments. I'm making this PR separate from the audio changes / larger reorganization to solicit feedback on the API changes alone.The main changes are:
numExamples
no longer need to be managed by usersFederatedModel
now has a simpler interface and can more transparently wraptf.Model
Just as I'm making this, I can think of a few opportunities to simplify the interface even further, but I'll elaborate in comments on the diff.
This change is