You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 line
1.9KB

  1. # Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
  2. FROM nvcr.io/nvidia/pytorch:20.12-py3
  3. # Install linux packages
  4. RUN apt update && apt install -y screen libgl1-mesa-glx
  5. # Install python dependencies
  6. RUN pip install --upgrade pip
  7. COPY requirements.txt .
  8. RUN pip install -r requirements.txt
  9. RUN pip install gsutil
  10. # Create working directory
  11. RUN mkdir -p /usr/src/app
  12. WORKDIR /usr/src/app
  13. # Copy contents
  14. COPY . /usr/src/app
  15. # Copy weights
  16. #RUN python3 -c "from models import *; \
  17. #attempt_download('weights/yolov5s.pt'); \
  18. #attempt_download('weights/yolov5m.pt'); \
  19. #attempt_download('weights/yolov5l.pt')"
  20. # --------------------------------------------------- Extras Below ---------------------------------------------------
  21. # Build and Push
  22. # t=ultralytics/yolov5:latest && sudo docker build -t $t . && sudo docker push $t
  23. # for v in {300..303}; do t=ultralytics/coco:v$v && sudo docker build -t $t . && sudo docker push $t; done
  24. # Pull and Run
  25. # t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
  26. # Pull and Run with local directory access
  27. # t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/coco:/usr/src/coco $t
  28. # Kill all
  29. # sudo docker kill $(sudo docker ps -q)
  30. # Kill all image-based
  31. # sudo docker kill $(sudo docker ps -a -q --filter ancestor=ultralytics/yolov5:latest)
  32. # Bash into running container
  33. # sudo docker container exec -it ba65811811ab bash
  34. # Bash into stopped container
  35. # sudo docker commit 092b16b25c5b usr/resume && sudo docker run -it --gpus all --ipc=host -v "$(pwd)"/coco:/usr/src/coco --entrypoint=sh usr/resume
  36. # Send weights to GCP
  37. # python -c "from utils.general import *; strip_optimizer('runs/train/exp0_*/weights/best.pt', 'tmp.pt')" && gsutil cp tmp.pt gs://*.pt
  38. # Clean up
  39. # docker system prune -a --volumes