2
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.

AutokerasをPyTorch0.4.1環境にインストールしてみる

Last updated at Posted at 2018-08-04

はじめに

Autokerasの0.2台が公開されました。
こちらの記事によると、Autokerasは「GoogleのAutoMLのより安価な代替」と言及されています。
https://towardsdatascience.com/autokeras-the-killer-of-googles-automl-9e84c552a319

ということで、興味を持ってpip install autokerasでインストールを試みるも、エラーが表示されてできなかったため、
なんとか試行錯誤し、インストールした結果を記します。

2018/08/04追記:
申し訳ありませんが、動作保証は致しかねます。

環境

Windows 10 Home
Python 3.6.6

トラブル

まず、公式ページの案内通り、
pip install autokeras
で何度かインストールを試みましたが、

(tensorflow) C:\Users\name_>pip install autokeras
Collecting autokeras
  Using cached https://files.pythonhosted.org/packages/db/ad/58e64a09febc4a0bdc2b0fd2440628301c09a01a96cef3cf4ca6e3c0e971/autokeras-0.2.1.tar.gz
Collecting torch==0.4.0 (from autokeras)
  Could not find a version that satisfies the requirement torch==0.4.0 (from autokeras) (from versions: 0.1.2, 0.1.2.post1)
No matching distribution found for torch==0.4.0 (from autokeras)

といったメッセージが表示され、インストールができませんでした。
この時点ではPytorchをインストールしていなかったため、
憶測ですが、pipがPyTouch0.4.1をインストールしようとして不整合を起こしていたのかもしれません。

ですので、以下の手順でAutokerasインストール時のバージョンチェックの回避を試みたいと思います。

手順

  1. Pytorchをインストール
  2. Autokerasのインストール用のアーカイバをダウンロード
  3. Setup.pyを書き換え
  4. pipでインストール

2018/08/04追記:
Setup.pyを書き換えたバージョンは、
https://github.com/MenEnger/autokeras/tree/MenEnger-patch-1-1
に置いています。

Pytorchをインストール

普通に、
pip install pytorch
ですね。(Anaconda環境ならconda install pytorchでしょうか?)

Autokerasのインストール用のアーカイバをダウンロード

1.以下のサイトから最新版のアーカイバをダウンロードしてください。
https://pypi.org/project/autokeras/0.2.1/#history
2. 任意の場所に解凍してください。

Setup.pyを書き換え

  1. ダウンロードしたアーカイバを解凍し、その直下のSetup.pyをLinuxの改行コードに対応しているエディタ(VScode、サクラエディタ等)で開いてください。

  2. 6行目のtorch==0.4.0torch==0.4.1に書き換え、保存してください。

  3. Setup.pyが配置されているフォルダごとtar.gzで圧縮してください。

pipでインストール

1.コマンドプロンプトを起動してください。
2. 圧縮したアーカイバが存在するフォルダに移動し、
pip install autokeras-0.2.1.tar.gz
を実行してください。

あとがき

書いていて気づいたのですが、最初にPytorch0.4.0をインストールすればよかったかもしれません(笑)

また、
http://autokeras.com/#example
にExampleとして掲示されているコードを実行しましたが、当然ながら「x_trainは未定義です」といったメッセージが表示されました。
ちなみに、以下のコードです。


import autokeras as ak

clf = ak.ImageClassifier()
clf.fit(x_train, y_train)
results = clf.predict(x_test)

また、
http://autokeras.com/start/#example
の例についても、
clf.fit(x_train, y_train, time_limit=12 * 60 * 60)
の行で、
TypeError: 'float' object cannot be interpreted as an integer
が表示されるので、Exampleはまだ不完全なのでしょうか。

2
1
3

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
2
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?