google-research / federated

A collection of Google research projects related to Federated Learning and Federated Analytics.
Apache License 2.0
693 stars 196 forks source link

Data loading is error #21

Closed codaibk closed 3 years ago

codaibk commented 3 years ago

Hi, Thanks for your framework. I tried to run your code but get this error "TypeError: Values of type cannot be cast to type " when loading emnist data. Do you know how I can fix it? Thanks.

ZacharyGarrett commented 3 years ago

Thanks for the report. Could you add which code was being run, and copy-paste the stack trace included with the error message?

codaibk commented 3 years ago

Thanks for your reply. I run differential privacy for emnist code. The error is shown in below pict: 1 2

codaibk commented 3 years ago

@ZacharyGarrett Hi, is there any update?

codaibk commented 3 years ago

It seems your original code has typo. It run smoothly after I changed the order of your code in function get_federated_datasets of emnist_dataset.py file. I used this one: feature_dtypes = collections.OrderedDict( label=tff.TensorType(tf.int32), pixels=tff.TensorType(tf.float32, shape=(28, 28)) ) instead of using your original code: feature_dtypes = collections.OrderedDict( pixels=tff.TensorType(tf.float32, shape=(28, 28)), label=tff.TensorType(tf.int32) )

ZacharyGarrett commented 3 years ago

Might commit https://github.com/google-research/federated/commit/bea0484a47fe5ef3cce4c945b36ed93e7f34f06e have fixed this issue?

zcharles8 commented 3 years ago

@codaibk As @ZacharyGarrett mentioned, commit bea0484a47fe5ef3cce4c945b36ed93e7f34f06e should fix the problem. Can you confirm or deny this?

codaibk commented 3 years ago

@zcharles8 ya, I just only changed the emnist_dataset.py and it fix the problem.