概述
我尝试了fastai发布的用于学习机器学习的教程。注意
,因为我沉迷于在本地运行它。
克隆
反正git clone
1 | $ git clone https://github.com/fastai/course-v3 |
添加了Dockerfile docker-compose.yml
Dockerfile
1 2 3 4 5 6 | 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
1 2 3 4 5 6 7 8 9 | version: '3' services: jupyter: build: . volumes: - ./:/home/jovyan shm_size: 4G # これ重要。デフォルト64MBらしくメモリが足りなくて計算中に落ちる。 ports: - 8888:8888 |
启动
1 2 3 4 5 6 7 8 9 | $ 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 |
带令牌的URL将被输出,因此访问它
通过上述操作,可以暂时执行lessen1。
如果即使在将内存增加到限制后仍由于错误而发生错误,请采取减少批处理大小之类的措施(这会花费很多时间。GPU仍然不错...)