1

I am new to machine learning and was trying out the "federated learning for image classification" code by Tensorflow (https://www.tensorflow.org/federated/tutorials/federated_learning_for_image_classification). I ran the code on Google Colab and did not modify anything.

#@test {"skip": true}

# tensorflow_federated_nightly also bring in tf_nightly, which
# can causes a duplicate tensorboard install, leading to errors.
!pip uninstall --yes tensorboard tb-nightly

!pip install --quiet --upgrade tensorflow-federated-nightly
!pip install --quiet --upgrade nest-asyncio
!pip install --quiet --upgrade tb-nightly  # or tensorboard, but not both

import nest_asyncio
nest_asyncio.apply()

%load_ext tensorboard

The above works well. (no errors) But when it comes to the below:

import collections

import numpy as np
import tensorflow as tf
import tensorflow_federated as tff

np.random.seed(0)

tff.federated_computation(lambda: 'Hello, World!')()

I got an error on the import tensorflow_federated as tff line:

AttributeError: module 'tensorflow_privacy' has no attribute 'DPQuery'

I've searched for solutions like pip install -U TensorFlow-privacy but none works.

Please help. Thanks in advance!

1 Answer 1

1

Not a solution to your problem but afaik no tutorial other than the tff optimizers require tff nightly, so you can just use stable tff releases.

!pip install --quiet --upgrade tensorflow-federated
!pip install --quiet --upgrade nest-asyncio

import nest_asyncio
nest_asyncio.apply()

this one should install tff 0.19

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! It worked! Is it possible for you to answer a follow-up question? While I was running the pip install codes, I got error message ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. spacy 2.2.4 requires tqdm<5.0.0,>=4.38.0, but you have tqdm 4.28.1 which is incompatible. pymc3 3.11.2 requires cachetools>=4.2.1, but you have cachetools 3.1.1 which is incompatible.... It doesn't seem to affect the installations, but I'm curious about solving this error. Thanks!
i do get the same errors but I dont know how to solve it. so far these errors caused no problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.