GithubHelp home page GithubHelp logo

Comments (10)

michaelreneer avatar michaelreneer commented on May 16, 2024

@wuzhiyu666 Can you go into more detail by what you mean when you say "when running"? Is it possible that you are possibly not using Bazel to run the models_test target?

bazel test tensorflow_federated/python/examples/mnist:models_test

You can see that there is a protobuf computation.proto located at the path that you referenced. Bazel will resolve these dependencies and eventually generate the python that you are looking for computation_pb2 from the computation.proto.

Take a look at our installation instructions for how to install Bazel and test TFF.

from federated.

jiyuay avatar jiyuay commented on May 16, 2024

thank you so much! I will try it.

from federated.

jiyuay avatar jiyuay commented on May 16, 2024

Sorry, when I used bazel to compile the code, it took 2 hours and failed in the end. when I say "when running", I am running the code "models_test" in pycharm. I have question that can I run the code in pycharm locally without bazel and docker?
Thank you so much! @michaelreneer

from federated.

michaelreneer avatar michaelreneer commented on May 16, 2024

So there are a few things here:

  • It's possible that it would take 2 hours to build. TFF has a source-level dependency on TensorFlow so you end up building TFF from source. This entirely depends on your machine.

  • We have a hard dependency on protobuf and converting the computation.proto in to the missing computation_pb2. Which practically means that we also have a dependency on Bazel. We don't have a dependency on Docker, you could use virtualenv to create a local environment. Docker or virtaulenv are used here to keep the pip package dependencies separated from the system Python.

  • You can use pycharm as an IDE if you want, but you still need to compile the protobuf. You would also need to install the packages that we do not build from source, you can find those in the requirements.txt.

  • I am curious about the error that you got after it took 2 hours to build. Did you happen to save the log? What command ended up failing?

Keep in mind you don't need to build everything from source to use TFF, you can instead pip install the pip package. You would not be able to run the unit tests by only installing the pip package, but you could use and play with the API.

from federated.

jiyuay avatar jiyuay commented on May 16, 2024

Thank you so much! @michaelreneer
Sorry for the late reply, I have reinstalled my operating system and run bazel again. But I got a new problem. The bazel have used up all my RAM and crash my computer.
Could you please tell me how to sovle the problem?
Thank you!

from federated.

jiyuay avatar jiyuay commented on May 16, 2024

I have a new question that if using bazel is not mandatory, is there another demo can I run without bazel?
I am new to federated-leaning and just want to run a demo to see how it works.
Thank you! @michaelreneer

from federated.

jkr26 avatar jkr26 commented on May 16, 2024

Hi @wuzhiyu666,

If you are looking for a demo, the place I would start is the Colab notebooks linked from tensorflow.org/federated, under tutorials, e.g.:

https://www.tensorflow.org/federated/tutorials/federated_learning_for_image_classification

If you open these notebooks, you will see a button for "open in Google Colab"; this will connect you to a runtime which allows you to step through the code and text, executing code block-by-block.

Hopefully this is what you are looking for! We are happy to hear of your interest in federated learning!

from federated.

michaelreneer avatar michaelreneer commented on May 16, 2024

@wuzhiyu666

As I mentioned before you can simply install the pip package to use TFF or you could do as @jkr26 suggested and run one of the TFF tutorials directly in your browser in Colab. I would strongly recommend one of these approachs, the easiest is simply running the notebook in your browser.*

Bazel is required to build TFF source. If you are having issues with Bazel RAM usage, you can check out this bazel build options documentation from TensorFlow or the Bazel documentation on the local_resources flag.

from federated.

michaelreneer avatar michaelreneer commented on May 16, 2024

@wuzhiyu666 As a data point for us, would you mind sharing the specs of your machine?

from federated.

RansSelected avatar RansSelected commented on May 16, 2024

Hi!

The error "ImportError: cannot import name 'computation_pb2'" still appears when running
python -c "import tensorflow_federated as tff; print(tff.federated_computation(lambda: 'Hello World')())"

even after installation of TF Fedefrated via Bazel. At the same time running
bazel test tensorflow_federated/python/examples/mnist:models_test
performs well, with no error.

Specs:
MacOS Sierra 10.12
Python 3.6
PyCharm CE 2019 IDE
Conda env

from federated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.