1
0

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.

fastai/course-v3をdocker環境でやってみる

Posted at

概要

機械学習の学習用にfastaiが公開しているチュートリアルをやってみました。ローカルで実行する際細々ハマったのでメモ

クローン

なにはともあれgit clone

$ git clone https://github.com/fastai/course-v3

Dockerfile docker-compose.ymlを追加

Dockerfile

FROM jupyter/base-notebook                                                                                                                                                                                          
USER root
RUN apt update
RUN apt install -y build-essential
USER $NB_UID
RUN pip install fastai

docker-compose.yml

version: '3'
services:
  jupyter:
    build: .
    volumes:
      - ./:/home/jovyan
    shm_size: 4G # これ重要。デフォルト64MBらしくメモリが足りなくて計算中に落ちる。
    ports:
      - 8888:8888

起動

$ docker-compose build
$ docker-compose up
Creating network "course-v3_default" with the default driver
Creating course-v3_jupyter_1 ... done
Attaching to course-v3_jupyter_1
jupyter_1  | Executing the command: jupyter notebook
~~中略
jupyter_1  |     Or copy and paste one of these URLs:
jupyter_1  |         http://(bc3f81290f54 or 127.0.0.1):8888/?token=xxxxxxxxx

token付きのURLが出力されるのでそこへアクセス

以上でとりあえずlessen1は実行できます。
限界までメモリ増やしてもエラーでエラーが起きる場合は、バッチサイズを小さくするなどして対応します(ものすごく時間はかかる。やはりGPUがいい。。。)

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?