Install TensorFlow Ranking

There are several ways to set up your environment to use the TensorFlow Ranking library.

  • The easiest way to learn and use TensorFlow Ranking is run any of the tutorials Google Colab. Select the link at the top of the Quickstart tutorial).
  • To use the Ranking library on a local machine, install the tensorflow_ranking pip package.
  • If you have a unique machine configuration, you can build the package from source, using the Build from source instructions.

Install TensorFlow Ranking using pip

Install using pip.

pipinstall--upgradetensorflow_ranking

Build from source

You can also install from source, which requires the Bazel build system.

  1. Install Bazel, Git and Pip.

    sudoapt-getupdate
    sudoapt-getinstallbazelgitpython3-pippython3-venv
  2. Clone the TensorFlow Ranking repository.

    gitclonehttps://github.com/tensorflow/ranking.git

  3. Build TensorFlow Ranking wheel file and store them in a /tmp/ranking_pip folder.

    cdranking# folder cloned in Step 2.
    bazelbuild//tensorflow_ranking/tools/pip_package:build_pip_package
    bazel-bin/tensorflow_ranking/tools/pip_package/build_pip_package\
    /tmp/ranking_pip
  4. Activate a venv environment.

    python3-mvenv--system-site-packagesvenv
    sourcevenv/bin/activate
  5. Install the wheel package in your venv environment.

    pip install /tmp/ranking_pip/tensorflow_ranking*.whl
    
  6. Optionally, run all TensorFlow Ranking tests.

    bazel test //tensorflow_ranking/...
    

For more information about installing Python, pip, TensorFlow, and working with Python virtual environments, see Install TensorFlow with pip.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2021年11月11日 UTC.