Install Neural Structured Learning
Stay organized with collections
Save and categorize content based on your preferences.
There are several ways to set up your environment to use Neural Structured Learning (NSL) in TensorFlow:
- The easiest way to learn and use NSL requires no installation: run the NSL tutorials directly in your browser using Google Colaboratory.
- To use NSL on a local machine, install the
NSL package with Python's
pippackage manager. - If you have a unique machine configuration, build NSL from source.
Install Neural Structured Learning using pip
1. Install the Python development environment.
On Ubuntu:
sudoaptupdatesudoaptinstallpython3-devpython3-pip# Python 3sudopip3install--upgradevirtualenv# system-wide install
On macOS:
/usr/bin/ruby-e"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"exportPATH="/usr/local/bin:/usr/local/sbin:$PATH"brewupdatebrewinstallpython# Python 3sudopip3install--upgradevirtualenv# system-wide install
2. Create a virtual environment.
virtualenv--pythonpython3"./venv"source"./venv/bin/activate"pipinstall--upgradepip
3. Install TensorFlow
CPU support:
pipinstall'tensorflow>=1.15.0'GPU support:
pipinstall'tensorflow-gpu>=1.15.0'4. Install the Neural Structured Learning pip package.
pipinstall--upgradeneural_structured_learning5. (Optional) Test Neural Structured Learning.
python-c"import neural_structured_learning as nsl"Build the Neural Structured Learning pip package
1. Install the Python development environment.
On Ubuntu:
sudoaptupdatesudoaptinstallpython3-devpython3-pip# Python 3sudopip3install--upgradevirtualenv# system-wide install
On macOS:
/usr/bin/ruby-e"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"exportPATH="/usr/local/bin:/usr/local/sbin:$PATH"brewupdatebrewinstallpython# Python 3sudopip3install--upgradevirtualenv# system-wide install
2. Install Bazel.
Install Bazel, the build tool used to compile Neural Structured Learning.
3. Clone the Neural Structured Learning repository.
gitclonehttps://github.com/tensorflow/neural-structured-learning.git4. Create a virtual environment.
virtualenv--pythonpython3"./venv"source"./venv/bin/activate"pipinstall--upgradepip
5. Install Tensorflow
Note that NSL requires a TensorFlow version of 1.15 or higher. NSL also supports TensorFlow 2.0.
CPU support:
pipinstall'tensorflow>=1.15.0'GPU support:
pipinstall'tensorflow-gpu>=1.15.0'6. Install Neural Structured Learning dependencies.
cdneural-structured-learningpipinstall--requirementneural_structured_learning/requirements.txt
7. (Optional) Unit Test Neural Structured Learning.
bazeltest//neural_structured_learning/...8. Build the pip package.
pythonsetup.pybdist_wheel--universal--dist-dir="./wheel"9. Install the pip package.
pipinstall--upgrade./wheel/neural_structured_learning*.whl10. Test Neural Structured Learning.
python-c"import neural_structured_learning as nsl"