https://nvidia.github.io/nvidia-container-runtime/
Then https://docs.docker.com/config/containers/resource_constraints/#gpu
Can't use compose here, see below.
Rename the correct compose file as docker-compose.yml then:
sudo docker-compose build --no-cache
sudo docker-compose up --detach
Docker-compose on jetson nano (docker-compose version is pre 1.28?) doesn't support GPUs, so do them separately.
First, build the images.
sudo docker build -t "artificialeconomist-tensorflow" -f ./docker/tf/Dockerfile_jetson.gpu .
sudo docker build -t "artificialeconomist-nodejs" -f ./docker/web/Dockerfile .
docker run is docker create and docker start
sudo docker run --restart=always --detach --name artificialeconomist-mongo -v /data/db/artificialeconomist_mongo:/data/db --expose 27017 mongo:4 mongod --port 27017 --bind_ip 0.0.0.0
sudo docker run --restart=always --detach --name artificialeconomist-tensorflow --gpus all --expose 8008 --link artificialeconomist-mongo:artificialeconomist-mongo ae:tensorflow
sudo docker run --restart=always --detach --name artificialeconomist-tensorflow --expose 8008 --link artificialeconomist-mongo:artificialeconomist-mongo ae:tensorflow
sudo docker run --restart=always --detach --name artificialeconomist-nodejs --link artificialeconomist-tensorflow:artificialeconomist-tensorflow --link artificialeconomist-mongo:artificialeconomist-mongo -p 8080:80 artificialeconomist-nodejs
sudo docker create --restart=always --name artificialeconomist-mongo -v /data/db/artificialeconomist_mongo:/data/db --expose 27017 mongo:4 mongod --port 27017 --bind_ip 0.0.0.0
sudo docker create --restart=always --name artificialeconomist-tensorflow --gpus all --expose 8008 --link artificialeconomist-mongo:artificialeconomist-mongo artificialeconomist-tensorflow
sudo docker create --restart=always --name artificialeconomist-tensorflow --expose 8008 --link artificialeconomist-mongo:artificialeconomist-mongo artificialeconomist-tensorflow
sudo docker create --restart=always --name artificialeconomist-nodejs --link artificialeconomist-tensorflow:artificialeconomist-tensorflow --link artificialeconomist-mongo:artificialeconomist-mongo -p 8080:80 artificialeconomist-nodejs
sudo docker start artificialeconomist-mongo
sudo docker start artificialeconomist-tensorflow
sudo docker start artificialeconomist-nodejs
Can check status of containers
sudo docker ps
sudo docker ps --all
Can restart?
sudo docker start
Can test:
wget artificialeconomist-tensorflow:8008/testquestion
This extends the GPT-2 model by training it on economics data.
temp: sudo systemctl isolate multi-user.target persistent sudo systemctl set-default multi-user.target
OLD:
https://devtalk.nvidia.com/default/topic/1049266/jetson-nano/headless-os/
- Make sure you have a backup
- Make sure you have ssh enabled (on the card image it is, but make sure...)
- sudo vi /boot/extlinux/extlinux.conf
- at the end of the APPEND line, after the rootwait, add 3. The line now looks like: APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait 3
sudo apt-get install poppler-utils
https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html
sudo pip3 install tensorflow-gpu
Alternatively, if no GPU,
pip3 install tensorflow==1.12.0
pip3 install pymongo
This will clone the GPT-2 model.
git clone 'https://github.com/nshepperd/gpt-2.git'
sudo pip3 install -r ./gpt-2/requirements.txt
cd gpt-2
python3 ./download_model.py 117M
cd ..
If needed, follow the instructions around tensor flow from the DEVELOPERS.md file.
OR NEW
git clone 'https://github.com/openai/gpt-2'
sudo pip3 install -r ./gpt-2/requirements.txt
cd gpt-2
python3 ./download_model.py 117M
cd ..
cp new_server.py ./gpt-2/src/
econstormodel/ to ./gpt-2/models/
econstormodel
Scrape PDFs.
./scrape.py
Also get PDFs from: https://open.umn.edu/opentextbooks/subjects/economics
Convert the PDFs to a single text file.
./toText.sh
Encode the text file.
./encode.sh
Train the model.
./train.sh
Query the model.
./query.sh
Note that this updates the default top_k and top_p from 0 and 0 respectively.
Install APT dependencies:
sudo apt install nodejs npm build-essential
Install npx
sudo npm -g install npx
Install NPM packages
npm install
Prepare public files with gulp
npx gulp
For testing
node server.js
Copy the service file.
sudo cp ./node-artificialeconomist.service /lib/systemd/system
sudo cp ./python-artificialeconomist.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl start node-artificialeconomist.service
sudo systemctl start python-artificialeconomist.service
Get certificates for www.artificialeconomist.com and artificialeconomist.com.
sudo systemctl stop apache2.service
sudo apt install certbot
sudo certbot certbot only
sudo systemctl start apache2.service
Forward from proxy server.
sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo cp ./node-artificialeconomist.conf /etc/apache2/sites-available
sudo a2ensite node-artificialeconomist.conf
sudo systemctl reload apache2