Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JA: translation /ja/install #442

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
118 changes: 118 additions & 0 deletions site/ja/install/_index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
project_path: /_project.yaml
book_path: /_book.yaml
description: <!--no description-->
landing_page:
custom_css_path: /site-assets/css/style.css
nav: both
rows:
- classname:
devsite-landing-row-large-headings
devsite-landing-row-100
items:
- heading: "TensorFlow 2.0 Alpha is available"
description: >
<p>
Install the preview release of <a href="/alpha">TensorFlow 2.0 Alpha</a>.
See the <a href="./gpu">GPU guide</a> for CUDA®-enabled cards.
</p>
<pre class="prettyprint lang-bsh">
<code class="devsite-terminal">pip install tensorflow==2.0.0-alpha0</code>
</pre>

- classname:
devsite-landing-row-large-headings
devsite-landing-row-100
items:
- heading: "Install TensorFlow"
description: >
<p>TensorFlow is tested and supported on the following 64-bit systems:</p>
<table class="columns">
<tr><td>
<ul>
<li>Ubuntu 16.04 or later</li>
<li>Windows 7 or later</li>
</ul>
</td><td>
<ul>
<li>macOS 10.12.6 (Sierra) or later (no GPU support)</li>
<li>Raspbian 9.0 or later</li>
</ul>
</td></tr>
</table>

- classname: >
devsite-landing-row-large-headings
devsite-landing-row-50
items:
- heading: Download a package
description: >
<p>Install TensorFlow with Python's <em>pip</em> package manager.</p>
<p>Official packages available for Ubuntu, Windows, macOS, and the Raspberry Pi.</p>
<p>See the <a href="./gpu">GPU guide</a> for CUDA®-enabled cards.</p>

buttons:
- label: Read the pip install guide
path: /install/pip
classname: button button-primary

code_block: |
<pre class="prettyprint lang-bsh devsite-disable-click-to-copy">
# Current stable release for CPU-only
<code class="devsite-terminal">pip install tensorflow</code><br/>
# Preview nightly build for CPU-only (unstable)
<code class="devsite-terminal">pip install tf-nightly</code><br/>
# Install TensorFlow 2.0 Alpha
<code class="devsite-terminal">pip install tensorflow==2.0.0-alpha0</code>

- classname:
devsite-landing-row-100
devsite-landing-row-large-headings
items:
- heading: Run a TensorFlow container
description: >
<p>
The <a href="https://hub.docker.com/r/tensorflow/tensorflow/" class="external">TensorFlow
Docker images</a> are already configured to run TensorFlow. A
<a href="https://docs.docker.com/install/" class="external">Docker</a> container runs in a
virtual environment and is the easiest way to set up <a href="/install/gpu">GPU
support</a>.
</p>
<pre class="prettyprint lang-bsh">
<code class="devsite-terminal">docker pull tensorflow/tensorflow # Download latest image</code><br/>
<code class="devsite-terminal">docker run -it -p 8888:8888 tensorflow/tensorflow # Start a Jupyter notebook server</code>
</pre>
buttons:
- label: Read the Docker install guide
path: /install/docker
classname: button button-primary

- classname:
devsite-landing-row-large-headings
devsite-landing-row-100
items:
- heading: Google Colab&#58; An easy way to learn and use TensorFlow
description: >
<p>
No install necessary—run the <a href="/tutorials">TensorFlow tutorials</a> directly in
the browser with <a href="https://colab.research.google.com/notebooks/welcome.ipynb"
class="external">Colaboratory</a>, a Google research project created to help disseminate
machine learning education and research. It's a Jupyter notebook environment that requires
no setup to use and runs entirely in the cloud.
<a href="https://medium.com/tensorflow/colab-an-easy-way-to-learn-and-use-tensorflow-d74d1686e309" class="external">Read the blog post</a>.
</p>

- background: grey
heading: Build your first ML app
description: Create and deploy TensorFlow models on web and mobile.
items:
- classname: tfo-landing-row-item-inset-white
heading: Web developers
path: https://js.tensorflow.org
description: >
TensorFlow.js is a WebGL accelerated, JavaScript library to train and
deploy ML models in the browser and for Node.js.
- classname: tfo-landing-row-item-inset-white
heading: Mobile developers
path: /lite/
description: >
TensorFlow Lite is a lightweight solution for mobile and embedded devices.
27 changes: 27 additions & 0 deletions site/ja/install/_toc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
toc:
- title: TensorFlowのインストール
path: /install/
- heading: パッケージ
- title: pip
path: /install/pip
- title: Docker
path: /install/docker
- heading: 追加のセットアップ
- title: GPUサポート
path: /install/gpu
- title: 問題
path: /install/errors
- heading: ソースからのビルド
- title: Linux / macOS
path: /install/source
- title: Windows
path: /install/source_windows
- title: Raspberry Pi
path: /install/source_rpi
- heading: 言語バインディング
- title: Java
path: /install/lang_java
- title: C
path: /install/lang_c
- title: Go
path: /install/lang_go
156 changes: 156 additions & 0 deletions site/ja/install/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Docker

[Docker](https://docs.docker.com/install/){:.external}は、*container*を使用して、
TensorFlowのインストールをシステムの他の部分から分離された仮想環境を作成します。
TensorFlowのプログラムは、この*仮想環境内*で実行され、ホストマシンとリソースを共有できます。
(ディレクトリーへのアクセス、GPUの使用、インターネットへの接続など)
[TensorFlowのDockerイメージ](https://hub.docker.com/r/tensorflow/tensorflow/){:.external}
は各リリースでテストされています。

Dockerは、LinuxでTensorFlowの[GPUサポート](./gpu.md)を有効にする最も簡単な方法です。
*ホスト*マシンに必要なのは
[NVIDIA® GPドライバー](https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#how-do-i-install-the-nvidia-driver){:.external}だけです。
(*NVIDIA® CUDA® Toolk*をインストールする必要はありません)


## TensorFlow Dockerの必要条件

1. [Dockerのインストール](https://docs.docker.com/install/){:.external}をローカル*ホスト*マシンで実行してください
2. LinuxでGPUサポートするには、[nvidia-dockerのインストール](https://github.com/NVIDIA/nvidia-docker){:.external}を実行してください

注: `sudo`なしで`docker`コマンドを実行するには、`docker`グループを作成してあなたのユーザーを追加してください。
詳しくは
[Linux用のインストール後の手順](https://docs.docker.com/install/linux/linux-postinstall/){:.external}を参照してください。


## TensorFlowのDockerイメージをダウンロードする

公式のTensorFlowのDockerイメージは、
[tensorflow/tensorflow](https://hub.docker.com/r/tensorflow/tensorflow/){:.external}
Docker Hubリポジトリにあります。
イメージリリースは、次の形式で[タグ付け](https://hub.docker.com/r/tensorflow/tensorflow/tags/){:.external}されています:

| タグ | 説明 |
| --- | --- |
| `latest` | 最新リリースのTensorFlowのCPUバイナリイメージ。デフォルト。 |
| `nightly` | TensorFlowのnightlyビルドのイメージ。(不安定) |
| *`version`* | TensorFlowのバイナリイメージの*version*を指定する。例: *1.12.0* |
| `devel` | TensorFlowのnightlyビルドの`master`開発環境。TensorFlowのソースコードを含む。 |

各ベーズ*tag*は、機能を追加または変更する亜種があります:

| タグ亜種 | 説明 |
| --- | --- |
| *`tag`*`-gpu` | GPUサポートの指定された*tag*リリース。 ([以下参照](#gpu_support)) |
| *`tag`*`-py3` | Python3サポートの指定された*tag*リリース。 |
| *`tag`*`-jupyter` | Jupyter付きの指定された*tag*リリース (TensorFlowのチュートリアルnotebooks含む) |

一度に複数の亜種を使用できます。例えば、
以下はTensorFlowリリースイメージをご使用のマシンにダウンロードします:

<pre class="devsite-click-to-copy prettyprint lang-bsh">
<code class="devsite-terminal">docker pull tensorflow/tensorflow # latest stable release</code>
<code class="devsite-terminal">docker pull tensorflow/tensorflow:devel-gpu # nightly dev release w/ GPU support</code>
<code class="devsite-terminal">docker pull tensorflow/tensorflow:latest-gpu-jupyter # latest release w/ GPU support and Jupyter</code>
</pre>


## TensorFlowのDockerコンテナを起動する

TensorFlowの設定コンテナを起動するには、次のコマンド形式を使用します:

<pre class="devsite-terminal devsite-click-to-copy">
docker run [-it] [--rm] [-p <em>hostPort</em>:<em>containerPort</em>] tensorflow/tensorflow[:<em>tag</em>] [<em>command</em>]
</pre>

詳細については、[docker run reference](https://docs.docker.com/engine/reference/run/){:.external}を参照してください。

### CPUのみのイメージを使った例

`latest`タグ付きイメージを使ってTensorFlowのインストールを確認しましょう。
Dockerは、初めて実行する際に新しいTensorFlowのイメージをダウンロードします:

<pre class="devsite-terminal devsite-click-to-copy prettyprint lang-bsh">
docker run -it --rm tensorflow/tensorflow \
python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
</pre>

成功: TensorFlowがインストールできました。[チュートリアル](../tutorials)を読んで始めましょう。

もう少しTensorFlowのDockerレシピをデモをしましょう。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「...レシピを使ったデモをしましょう」 will be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comment, mattn. Which of the following sentences is better?

  • 「もう少しTensorFlowのDockerのレシピを使ったデモをしましょう」
  • 「もう少しTensorFlowのDockerの使い方を見てみましょう」

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original sentense use demonstrate so I prefer the second. (but this is just my optinion. Using "を" twice bothers me) :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

TensorFlowで設定されたコンテナ内で `bash`シェルセッションを開始します:

<pre class="devsite-terminal devsite-click-to-copy">
docker run -it tensorflow/tensorflow bash
</pre>

コンテナ内で、`python`セッションを開始してTensorFlowをインポートすることができます。

コンテナ内の*ホスト*マシン上で開発されたTensorFlowプログラムを実行するには、
ホストディレクトリをマウントしてコンテナの作業ディレクトリを変更します。
(`-v hostDir:containerDir -w workDir`):

<pre class="devsite-terminal devsite-click-to-copy prettyprint lang-bsh">
docker run -it --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow python ./script.py
</pre>

コンテナ内で作成されたファイルがホストに公開されると、アクセス権限の問題が発生する可能性があります。
通常はホストシステム上のファイルを編集するのがベストです。

Python3サポート付きのTensorFlowのnightlyビルドを使用した
[Jupyter Notebook](https://jupyter.org/){:.external}サーバーを起動してください:

<pre class="devsite-terminal devsite-click-to-copy">
docker run -it -p 8888:8888 tensorflow/tensorflow:nightly-py3-jupyter
</pre>

手順に従い、ご使用のホストのWebブラウザ内で以下のURLを開きます:
`http://127.0.0.1:8888/?token=...`


## GPUサポート

Dockerは、GPUでTensorFlowを実行する最も簡単な方法です。
*ホスト*マシンに必要なのは
[NVIDIA® GPUドライバー](https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#how-do-i-install-the-nvidia-driver){:.external}だけです。
(*NVIDIA® CUDA® Toolk*をインストールする必要はありません)

NVIDIA® GPUをサポートするDockerコンテナを起動するには、
[nvidia-docker](https://github.com/NVIDIA/nvidia-docker){:.external}をインストールしてください。
`nvidia-docker`はLinuxでのみ利用可能です。詳細は、
[プラットフォームサポートFAQ](https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#platform-support){:.external}
を参照してください。

GPUが利用可能か確認します:

<pre class="devsite-terminal devsite-click-to-copy">
lspci | grep -i nvidia
</pre>

`nvidia-docker`がインストールされたことを確認してください:

<pre class="devsite-terminal devsite-click-to-copy">
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
</pre>

注: `nvidia-docker` v1は`nvidia-docker`エイリアスを使います。v2は `docker --runtime=nvidia`を使用します。

### GPUが有効なイメージを使った例

GPU対応のTensorFlowのイメージをダウンロードして実行します(数分かかる場合があります)。

<pre class="devsite-terminal devsite-click-to-copy prettyprint lang-bsh">
docker run --runtime=nvidia -it --rm tensorflow/tensorflow:latest-gpu \
python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
</pre>

GPU対応のイメージの設定にはしばらく時間がかかる場合があります。
GPUベースのスクリプトを繰り返し実行する場合は、`docker exec`を使ってコンテナを再利用できます。

コンテナ内で`bash`シェルセッションを開始するために、最新のTensorFlowのGPUイメージを使用してください:

<pre class="devsite-terminal devsite-click-to-copy">
docker run --runtime=nvidia -it tensorflow/tensorflow:latest-gpu bash
</pre>

成功: TensorFlowがインストールできました。[チュートリアル](../tutorials)を読んで始めましょう。