Comments (11)
Hi,
Is there any update or suggestion to fix this issue? because your cifar10 setting is only ok with 10 clients but not for flexible number of client. @ZacharyGarrett
from federated.
Hi,
Is there any update or suggestion to fix this issue? because your cifar10 setting is only ok with 10 clients but not for flexible number of client. @ZacharyGarrett
Hi,
I think there is a typo in the utils/datasets/cifar10_dataset.py
file. The code on line 101 seems wrong.
federated/utils/datasets/cifar10_dataset.py
Line 101 in 42ec496
The correct one should be
for k in range(NUM_CLIENTS):
from federated.
Thanks for investigating @xjiajiahao! Would you be willing to submit a pull request to make the change?
from federated.
@xjiajiahao @ZacharyGarrett Change only that line will not fix problem because the code determine train_client_samples
based on "train_example_indices" index:
train_client_samples[k].append( train_example_indices[sampled_label, train_count[sampled_label]])
and train_example_indices size is set based on number of examples each class (5000 for train, 1000 for test)
When you change NUM_CLIENTS
=> NUM_EXAMPLES_PER_CLIENT
and TEST_SAMPLES_PER_CLIENT
will be changed too. This one will make the error.
`for k in range(NUM_CLIENTS):
for i in range(NUM_EXAMPLES_PER_CLIENT):
sampled_label = np.argwhere(
np.random.multinomial(1, train_multinomial_vals[k, :]) == 1)[0][0]
train_client_samples[k].append(
train_example_indices[sampled_label, train_count[sampled_label]])
train_count[sampled_label] += 1
if train_count[sampled_label] == NUM_EXAMPLES_PER_CLIENT:
train_multinomial_vals[:, sampled_label] = 0
train_multinomial_vals = (
train_multinomial_vals /
train_multinomial_vals.sum(axis=1)[:, None])`
- With
NUM_CLIENTS
< 10. The error is :`IndexError: index 5000 is out of bounds for axis 1 with size 5000 - With
NUM_CLIENTS
> 10. The error is:np.random.multinomial(1, train_multinomial_vals[k, :]) == 1)[0][0] File "mtrand.pyx", line 4212, in numpy.random.mtrand.RandomState.multinomial File "_common.pyx", line 338, in numpy.random._common.check_array_constraint ValueError: pvals < 0, pvals > 1 or pvals contains NaNs
from federated.
@hsidahmed865 has kindly offered to take a look and potentially submit a fix, as they have been bumping up against this. Thanks @hsidahmed865!
from federated.
Hi @codaibk. This issue should have been fixed by commits 74fdc16 and 83b23c3. Can you confirm whether or not this fixed your problem?
from federated.
Sorry, but it does not fix the problem. The problem is that this code can't deal with flexible number of clients like I mentioned above. And you guys commits here don't change anything about algorithm but just only change the parameters. @zcharles8
from federated.
Hi @codaibk. Can you verify that your version of the repository includes the commit I listed above? They have added the functionality to allow the user to specify num_clients
.
If so, can you run the following test using bazel
: https://github.com/google-research/federated/blob/master/utils/datasets/cifar10_dataset_test.py
This test is passing for me, and explicitly tests num_clients = 8
, num_clients = 10
, and num_clients = 100
.
from federated.
@zcharles8 . it seems you guys changed the run file run_federated.py
in differential privacy folder too. The old file will call cifar10_dataset.py
for generating data.
could you tell me what is the command for program running with cifar10_dataset_test.py
?
Thanks.
from federated.
We recommend using Bazel (see https://bazel.build/). Once you have that configured, you can simply run bazel test {path to test}:{test_name}
in order to run a test.
If you'd prefer to not use Bazel, you could run cifar10_dataset.load_cifar10_federated
with different numbers of num_clients
arguments, and make sure that you get a dataset with the requisite number of clients.
from federated.
Hi @codaibk. I am marking this as resolved for now, as it is working according to all of our tests. If you are still seeing errors, please post your full stack trace, as well as the commands that resulted in the error.
from federated.
Related Issues (20)
- Question on the Implementation of FedYOGI HOT 1
- some questions when run examples in [federated optimization] module. HOT 2
- Issues of federated-gans HOT 2
- AttributeError while trying to run optimization HOT 1
- [optimization]reproduce the result of paper "ADAPTIVE FEDERATED OPTIMIZATION" HOT 7
- [optimization]Split EMNIST and Stackoverflow Evenly HOT 1
- On Dirichlet Concentration Factor HOT 3
- Clarification the result of paper "ADAPTIVE FEDERATED OPTIMIZATION" HOT 2
- TFF reconstruction for time-series prediction HOT 1
- [distributed_dp] Including package versions into the requirements file HOT 12
- [distributed-dp] running of fl_run: AttributeError: module 'tensorflow_federated.python.program' has no attribute 'TensorBoardReleaseManager' HOT 2
- [differential_privacy] Learning rates used for Adaptive Clipping experiments HOT 6
- Flags not consistent in federated/utils/optimizers/optimizer_utils.py
- [large_cohort] AttributeError: 'LearningAlgorithmState' object has no attribute 'model' HOT 3
- Calling bazel within cache directory fails: experiments/emnist:run_experiments
- [federated/targeted_attack] targeted_attack example documentation is inconsistent
- `optimization/`: `num_validation_examples` batches instead of examples
- [distributed-dp] DSkellam goes weird w/ small num_bits HOT 3
- [Distributed DP] Cannot capture a result of an unsupported type NoneType
- Can you provide a Linux version of jaxlib 0.3.14 for download
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from federated.