0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mac OSにSonnetをインストール

Posted at

Sonnetをインストールする

Anacondaを使い、2.7の環境を作ります。

$ conda create --name py2.7 python=2.7
$ source activate py27
$ cd
$ pip install numpy tensorflow scipy pandas matplotlib
$ pip install --upgrade IPython
$ git clone --recursive https://github.com/deepmind/sonnet
$ cd sonnet/tensorflow
$ ./configure
$ cd ../
$ mkdir /tmp/sonnet
$ bazel build --config=opt :install
$ ./bazel-bin/install /tmp/sonnet
$ pip install /tmp/sonnet/*.whl
$ pip install sonnet

TensorFlowが1.0.1であることを確認。もしくはそれ以上

$ python -c "import tensorflow as tf; print(tf.__version__)"
$ cd ~/
$ python
>>> import sonnet as snt
>>> import tensorflow as tf
>>> snt.resampler(tf.constant([0.]), tf.constant([0.]))

Importエラー等が出たら、再度以下を実行し最初から試す。

$ pip uninstall sonnet
$ cd
$ cd sonnet/tensorflow
$ ./configure
$ cd ../
$ bazel build --config=opt :install
$ ./bazel-bin/install /tmp/sonnet
$ pip install /tmp/sonnet/*.whl

Sonnetが正常にインストールされたことを確認

(py27) HawkMacBook-Air:~ hawk$ python
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import sonnet as snt
>>> import tensorflow as tf
>>> snt.resampler(tf.constant([0.]), tf.constant([0.]))
<tf.Tensor 'resampler/Resampler:0' shape=(1,) dtype=float32>
>>> 

参考記事

https://github.com/deepmind/sonnet
http://www.procrasist.com/entry/sonnet-memo
http://deeplearning.hatenablog.com/entry/sonnet

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?