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

userdata.sh 1.2 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
  1. #!/bin/bash
  2. # AWS EC2 instance startup script https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
  3. # This script will run only once on first instance start (for a re-start script see mime.sh)
  4. # /home/ubuntu (ubuntu) or /home/ec2-user (amazon-linux) is working dir
  5. # Use >300 GB SSD
  6. cd home/ubuntu
  7. if [ ! -d yolov5 ]; then
  8. echo "Running first-time script." # install dependencies, download COCO, pull Docker
  9. git clone https://github.com/ultralytics/yolov5 -b master && sudo chmod -R 777 yolov5
  10. cd yolov5
  11. bash data/scripts/get_coco.sh && echo "COCO done." &
  12. sudo docker pull ultralytics/yolov5:latest && echo "Docker done." &
  13. python -m pip install --upgrade pip && pip install -r requirements.txt && python detect.py && echo "Requirements done." &
  14. wait && echo "All tasks done." # finish background tasks
  15. else
  16. echo "Running re-start script." # resume interrupted runs
  17. i=0
  18. list=$(sudo docker ps -qa) # container list i.e. $'one\ntwo\nthree\nfour'
  19. while IFS= read -r id; do
  20. ((i++))
  21. echo "restarting container $i: $id"
  22. sudo docker start $id
  23. # sudo docker exec -it $id python train.py --resume # single-GPU
  24. sudo docker exec -d $id python utils/aws/resume.py # multi-scenario
  25. done <<<"$list"
  26. fi
Tip!

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

Comments

Loading...