Setup the VM for learning fast.ai (http://course.fast.ai/)
The install-gpu.sh in modified from https://github.com/fastai/courses.git
- install vagrant (https://www.vagrantup.com) & virtualbox (https://www.virtualbox.org)
- download this repository:
git clone https://github.com/pomelyu/fastainn_setup.git
or download the zip - config the VM (in Vagrantfile):
Forward the port used by jupyter notebook to localhost
config.vm.network "forwarded_port", guest: 8888, host: 8888
Config the synced forder from host computer to VM
config.vm.synced_folder "./data", "/data"
config.vm.synced_folder "./course", "/home/vagrant/course"
Setup the VM memory
vb.memory = "8196"
2G RAM is not enough for even the minimum batch_size 4
8G RAM is OK for batch_size 16
See http://gogojimmy.net/2013/05/26/vagrant-tutorial/ for more detail about the Vagrantfile
- in repository root folder run
vagrant up
to boot the VM - use
vagrant ssh
to login the VM cd ../../data
and./install-gpu_modified.sh
to install and config Anaconda, theano, keras, cudnn and jupyter notebookvim ~/.jupyter/jupyter_notebook_config.py
to change the password of jupyter server (I have failed to config the password in the step, so I run the step 9. instead)- logout and then login the VM again to source the jupyter environment variable.
cd ~/course/nbs/
andjupyter notebook password
to change the password of jupyter server- In directory
~/course/nbs/
, runjupyter notebook
to start the server - In host computer browser, enter
localhost:8888
and type the password to access the notebook
- Run
./get-lesson1.sh
vim ~/.theanorc
modify[global] device=gpu
to[global] device=cpu
vim ~/.keras/keras.json
to setup the backend astheano
vagrant 是一個可以方便設定虛擬機的工具,背後要用到 virtual box。但使用起來比 vb 還要輕量很多,
ref: http://gogojimmy.net/2013/05/26/vagrant-tutorial/
vagrant up
VM 開機vagrant ssh
ssh 登入 VM,預設 port 22vagrant halt
VM 關機,建議沒事不用關機vagrant suspend
VM 暫停,這個即使整台電腦重開也可以回復狀態vagrant resume
回復 VM 狀態vagrant box add
加入 boxvagrant box list
列出所有 boxvagrant init
產生 default 的 Vagrantfile
讓 terminal 可以以一次跑多個程式,並可以儲存或還原目前的狀態,
ref: http://blog.chh.tw/posts/tmux-terminal-multiplexer/
tmux
開啟 tmuxtmux attach
回復之前 detach 的狀態ctrl+b
+"
產生上下分割視窗ctrl+b
+%
產生左右分割視窗ctrl+b
+o
切換游標的位置ctrl+b
+d
detach 目前狀態,回到原先的介面,程式還在背景執行