(NOTE: this doesn't work anymore)
This repository contains a Ruby API for utilizing TensorFlow.
Linux CPU |
Linux GPU PIP |
Mac OS CPU |
---|---|---|
Not Configured | Not Configured |
Everything is at RubyDoc.
You can also generate docs by
bundle exec rake doc
.
I have made a make shift install script in tools directory. You are free to use it, but it still needs some work and there is a chance that you might face some issues with it and if you do face some issues, you can use the instructions below. You are welcome to make improvements to the script.
It's easiest to get started using the prebuilt Docker container.
Launch:
docker run --rm -it nethsix/ruby-tensorflow-ubuntu:0.0.1 /bin/bash
Test:
cd /repos/tensorflow.rb/
bundle exec rspec
Image Classification Tutorial:
cd /repos/tensorflow.rb/image/
cat README
For more details about all the fun machine-learning stuff already pre-installed, see: https://hub.docker.com/r/nethsix/ruby-tensorflow-ubuntu/
Alternatively, you can install outside of a Docker container by following the following steps.
gem install google-protoc --pre
)All the dependencies mentioned above must be installed in your system before you proceed further.
This package depends on the TensorFlow shared libraries, in order to compile these libraries do the following:
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
cd tensorflow
./configure
This command clones the repository and a few sub modules. After this you should do:
bazel build -c opt //tensorflow:libtensorflow.so
This command takes in the order of 10-15 minutes to run and creates a shared library. When finished, copy the newly generated libtensorflow.so shared library:
# Linux
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/lib/
sudo cp bazel-bin/tensorflow/libtensorflow_framework.so /usr/lib
# OSX
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib
sudo cp bazel-bin/tensorflow/libtensorflow_framework.so /usr/lib
export LIBRARY_PATH=$PATH:/usr/local/lib (may be required)
tensorflow.rb
Clone and install this Ruby API:
git clone https://github.com/somaticio/tensorflow.rb.git
cd tensorflow.rb/ext/sciruby/tensorflow_c
ruby extconf.rb
make
make install # Creates ../lib/ruby/site_ruby/X.X.X/<arch>/sciruby/Tensorflow.{bundle, so}
cd ./../../..
bundle install
bundle exec rake install
The last command is for installing the gem.
bundle exec rake spec
This command is to run the tests.
You can run tensorboard on tensorflow.rb too. Just take a look at tensorboard.md file.
Copyright (c) 2016, Arafat Dad Khan. somatic
All rights reserved.