Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ax_lite_train.sh 3.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  1. #!/bin/bash
  2. #
  3. # Container source: https://github.com/OpenAccess-AI-Collective/axolotl/blob/main/docker/Dockerfile-runpod
  4. #
  5. #
  6. # To run this in RunPod with `winglian/axolotl-runpod:main-py3.10-cu118-2.0.1`, set
  7. # Expose HTTP Ports (Max 10): 7860,8888
  8. # docker command: `bash -c "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/utensil/llm-playground/main/scripts/entry/ax_lite.sh -sSf | bash"`
  9. # JUPYTER_PASSWORD change to your secret
  10. # HUGGINGFACE_TOKEN change to your token from https://huggingface.co/settings/tokens
  11. # WORKSPACE /workspace/
  12. # WANDB_API_KEY change to your key from https://wandb.ai/authorize
  13. #
  14. # MUST mount volume disk at /content/
  15. #
  16. # To test this in Codespaces, run `cd /workspaces/ && WORKSPACE=/workspaces/ llm-playground/scripts/entry/ax_lite.sh`
  17. set -euxo pipefail
  18. set -x
  19. WORKSPACE=${WORKSPACE:-"/workspace"}
  20. export DEBIAN_FRONTEND=noninteractive
  21. # make the cache live on volume disk
  22. rm -rf /root/.cache
  23. mkdir -p /content/cache
  24. ln -s /content/cache /root/.cache
  25. # prepare jupyter
  26. pip install jupyterhub notebook jupyterlab jupyterlab-git ipywidgets
  27. # prepare monitoring GPU
  28. pip install nvitop
  29. AXOLOTL_GIT=${AXOLOTL_GIT:-"https://github.com/OpenAccess-AI-Collective/axolotl"}
  30. AXOLOTL_GIT_BRANCH=${AXOLOTL_GIT_BRANCH:-"main"}
  31. # update axolotl
  32. cd $WORKSPACE
  33. if [ ! -d "axolotl-update" ]; then
  34. git clone -b $AXOLOTL_GIT_BRANCH --single-branch $AXOLOTL_GIT axolotl-update
  35. # don't update between runs yet
  36. # else
  37. # cd axolotl-update && git pull && cd ..
  38. fi
  39. cp -rf axolotl-update axolotl
  40. cd axolotl
  41. pip install -e .
  42. mkdir -p /content/
  43. cd /content/
  44. if [ ! -d "llm-playground" ]; then
  45. git clone https://github.com/utensil/llm-playground
  46. # don't update between run yet
  47. # else
  48. # cd llm-playground && git pull && cd ..
  49. fi
  50. cd $WORKSPACE
  51. # don't update peft
  52. # PEFT_COMMIT_HASH=${PEFT_COMMIT_HASH:-"main"}
  53. # pip install git+https://github.com/huggingface/peft.git@$PEFT_COMMIT_HASH
  54. JUPYTER_PASSWORD=${JUPYTER_PASSWORD:-"axolotl"}
  55. echo "Launching Jupyter Lab with nohup..."
  56. cd /
  57. nohup jupyter lab --allow-root --no-browser --port=8888 --ip=* --ServerApp.token=$JUPYTER_PASSWORD --ServerApp.allow_origin=* --ServerApp.preferred_dir=$WORKSPACE &
  58. TRAINING_CONFIG=${TRAINING_CONFIG:-""}
  59. if [[ -n $TRAINING_CONFIG ]]
  60. then
  61. # Fixes update hang
  62. # apt-get update
  63. apt-get install -y aria2
  64. git lfs install
  65. pip install requests huggingface_hub discord.py pexpect pytest
  66. # Fixes https://github.com/huggingface/accelerate/pull/1648#issuecomment-1610178618
  67. # pip install --upgrade --force-reinstall git+https://github.com/huggingface/accelerate.git
  68. pip install -U git+https://github.com/huggingface/peft.git
  69. pip install git+https://github.com/utensil/runpod-python@pod
  70. # Fixes https://github.com/microsoft/DeepSpeed/issues/3963
  71. pip install pydantic==1.10.10
  72. # Optional: for deepspeed
  73. pip3 install -U torch --index-url https://download.pytorch.org/whl/cu118
  74. cd /content/llm-playground
  75. (python /content/llm-playground/helper/download-model.py $PREDOWNLOAD_MODEL || true )
  76. (accelerate launch helper/train.py $TRAINING_CONFIG || python /content/llm-playground/helper/terminate-runpod.py )
  77. fi
  78. sleep infinity
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...