Team Ai
Apppublic

SudiptaKumar/object_detection

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
userdata.sh28 linesDownload Raw Back to aws
1#!/bin/bash2# AWS EC2 instance startup script https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html3# 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 dir5# Use >300 GB SSD6 7cd home/ubuntu8if [ ! -d yolor ]; then9  echo "Running first-time script." # install dependencies, download COCO, pull Docker10  git clone -b main https://github.com/WongKinYiu/yolov7 && sudo chmod -R 777 yolov711  cd yolov712  bash data/scripts/get_coco.sh && echo "Data done." &13  sudo docker pull nvcr.io/nvidia/pytorch:21.08-py3 && echo "Docker done." &14  python -m pip install --upgrade pip && pip install -r requirements.txt && python detect.py && echo "Requirements done." &15  wait && echo "All tasks done." # finish background tasks16else17  echo "Running re-start script." # resume interrupted runs18  i=019  list=$(sudo docker ps -qa) # container list i.e. $'one\ntwo\nthree\nfour'20  while IFS= read -r id; do21    ((i++))22    echo "restarting container $i: $id"23    sudo docker start $id24    # sudo docker exec -it $id python train.py --resume # single-GPU25    sudo docker exec -d $id python utils/aws/resume.py # multi-scenario26  done <<<"$list"27fi28