Add GPU Dockerfile
Browse files- .gitignore +1 -0
- Dockerfile +11 -0
- Makefile +15 -0
- notebooks/.gitkeep +0 -0
- notebooks/jax.ipynb +117 -0
- src/__init__.py +0 -0
- run_clm_flax.py → src/run_clm_flax.py +0 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.ipynb_checkpoints
|
Dockerfile
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM tensorflow/tensorflow:2.5.0-gpu-jupyter
|
| 2 |
+
|
| 3 |
+
RUN pip install --use-feature=2020-resolver tensorflow_hub tensorflow-probability tokenizers transformers[sentencepiece] datasets knockknock pandas panel click rich[jupyter] nltk spacy scikit-learn https://github.com/kpu/kenlm/archive/master.zip markovify
|
| 4 |
+
|
| 5 |
+
RUN pip install --use-feature=2020-resolver "jax[cuda111]" -f https://storage.googleapis.com/jax-releases/jax_releases.html flax
|
| 6 |
+
|
| 7 |
+
# RUN pip install --no-warn-script-location --use-feature=2020-resolver --user -q tensorflow_text add a check to see which version of tf it installs
|
| 8 |
+
|
| 9 |
+
# RUN pip uninstall -y tensorflow==??? TODO: automatically detect which tf-cpu version tf_text installs to be able to remove it.
|
| 10 |
+
|
| 11 |
+
CMD ["bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root"]
|
Makefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
VERSION := 0.0.1
|
| 2 |
+
NAME := gpt-2-german
|
| 3 |
+
REPO := cakiki
|
| 4 |
+
|
| 5 |
+
build: clean
|
| 6 |
+
docker build -t ${REPO}/${NAME}:${VERSION} -t ${REPO}/${NAME}:latest .
|
| 7 |
+
|
| 8 |
+
run: build
|
| 9 |
+
docker run --rm -it -p 8888:8888 -p 6006:6006 --gpus all --env PYTHONPATH=/tf/src --mount type=bind,source=${PWD},target=/tf ${REPO}/${NAME}:${VERSION} && make -s clean
|
| 10 |
+
|
| 11 |
+
clean:
|
| 12 |
+
sudo chown -R 1000:1000 .
|
| 13 |
+
|
| 14 |
+
push: build
|
| 15 |
+
docker push ${REPO}/${NAME}:${VERSION} && docker push ${REPO}/${NAME}:latest
|
notebooks/.gitkeep
ADDED
|
File without changes
|
notebooks/jax.ipynb
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "af8ae1be",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"data": {
|
| 11 |
+
"text/html": [
|
| 12 |
+
"<style>.container { width:95% !important; }</style>"
|
| 13 |
+
],
|
| 14 |
+
"text/plain": [
|
| 15 |
+
"<IPython.core.display.HTML object>"
|
| 16 |
+
]
|
| 17 |
+
},
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"output_type": "display_data"
|
| 20 |
+
}
|
| 21 |
+
],
|
| 22 |
+
"source": [
|
| 23 |
+
"from IPython.core.display import display, HTML\n",
|
| 24 |
+
"display(HTML(\"<style>.container { width:95% !important; }</style>\"))\n",
|
| 25 |
+
"%config IPCompleter.use_jedi=False"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"cell_type": "code",
|
| 30 |
+
"execution_count": 2,
|
| 31 |
+
"id": "b7668713",
|
| 32 |
+
"metadata": {},
|
| 33 |
+
"outputs": [],
|
| 34 |
+
"source": [
|
| 35 |
+
"import jax"
|
| 36 |
+
]
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"cell_type": "code",
|
| 40 |
+
"execution_count": 3,
|
| 41 |
+
"id": "485f9423",
|
| 42 |
+
"metadata": {},
|
| 43 |
+
"outputs": [
|
| 44 |
+
{
|
| 45 |
+
"data": {
|
| 46 |
+
"text/plain": [
|
| 47 |
+
"[GpuDevice(id=0, process_index=0)]"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
"execution_count": 3,
|
| 51 |
+
"metadata": {},
|
| 52 |
+
"output_type": "execute_result"
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"source": [
|
| 56 |
+
"jax.devices()"
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"cell_type": "code",
|
| 61 |
+
"execution_count": 4,
|
| 62 |
+
"id": "d59b2dd7",
|
| 63 |
+
"metadata": {},
|
| 64 |
+
"outputs": [
|
| 65 |
+
{
|
| 66 |
+
"name": "stdout",
|
| 67 |
+
"output_type": "stream",
|
| 68 |
+
"text": [
|
| 69 |
+
"Fri Jul 2 07:46:55 2021 \r\n",
|
| 70 |
+
"+-----------------------------------------------------------------------------+\r\n",
|
| 71 |
+
"| NVIDIA-SMI 460.84 Driver Version: 460.84 CUDA Version: 11.2 |\r\n",
|
| 72 |
+
"|-------------------------------+----------------------+----------------------+\r\n",
|
| 73 |
+
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n",
|
| 74 |
+
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n",
|
| 75 |
+
"| | | MIG M. |\r\n",
|
| 76 |
+
"|===============================+======================+======================|\r\n",
|
| 77 |
+
"| 0 TITAN RTX Off | 00000000:C1:00.0 On | N/A |\r\n",
|
| 78 |
+
"| 41% 54C P0 66W / 280W | 1260MiB / 24217MiB | 1% Default |\r\n",
|
| 79 |
+
"| | | N/A |\r\n",
|
| 80 |
+
"+-------------------------------+----------------------+----------------------+\r\n",
|
| 81 |
+
" \r\n",
|
| 82 |
+
"+-----------------------------------------------------------------------------+\r\n",
|
| 83 |
+
"| Processes: |\r\n",
|
| 84 |
+
"| GPU GI CI PID Type Process name GPU Memory |\r\n",
|
| 85 |
+
"| ID ID Usage |\r\n",
|
| 86 |
+
"|=============================================================================|\r\n",
|
| 87 |
+
"+-----------------------------------------------------------------------------+\r\n"
|
| 88 |
+
]
|
| 89 |
+
}
|
| 90 |
+
],
|
| 91 |
+
"source": [
|
| 92 |
+
"!nvidia-smi"
|
| 93 |
+
]
|
| 94 |
+
}
|
| 95 |
+
],
|
| 96 |
+
"metadata": {
|
| 97 |
+
"kernelspec": {
|
| 98 |
+
"display_name": "Python 3",
|
| 99 |
+
"language": "python",
|
| 100 |
+
"name": "python3"
|
| 101 |
+
},
|
| 102 |
+
"language_info": {
|
| 103 |
+
"codemirror_mode": {
|
| 104 |
+
"name": "ipython",
|
| 105 |
+
"version": 3
|
| 106 |
+
},
|
| 107 |
+
"file_extension": ".py",
|
| 108 |
+
"mimetype": "text/x-python",
|
| 109 |
+
"name": "python",
|
| 110 |
+
"nbconvert_exporter": "python",
|
| 111 |
+
"pygments_lexer": "ipython3",
|
| 112 |
+
"version": "3.6.9"
|
| 113 |
+
}
|
| 114 |
+
},
|
| 115 |
+
"nbformat": 4,
|
| 116 |
+
"nbformat_minor": 5
|
| 117 |
+
}
|
src/__init__.py
ADDED
|
File without changes
|
run_clm_flax.py → src/run_clm_flax.py
RENAMED
|
File without changes
|