wandb-entrypoint.sh 989 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. set -e
  3. wandb="\x1b[34m\x1b[1mwandb\x1b[0m"
  4. /bin/echo -e "${wandb}: Checking image for required packages."
  5. if ! [ -x "$(command -v python)" ]; then
  6. /bin/echo -e "${wandb}: python not installed, can't use wandb with this image."
  7. exit 1
  8. fi
  9. if ! [ -x "$(command -v wandb)" ]; then
  10. /bin/echo -e "${wandb}: wandb not installed, installing."
  11. pip install wandb --upgrade
  12. else
  13. ver=$(wandb --version)
  14. /bin/echo -e "${wandb}: Found $ver"
  15. fi
  16. if [ "$WANDB_ENSURE_JUPYTER" = "1" ]; then
  17. if ! [ -x "$(command -v jupyter-lab)" ]; then
  18. /bin/echo -e "${wandb}: jupyter not installed, installing."
  19. pip install jupyterlab
  20. /bin/echo -e "${wandb}: starting jupyter, you can access it at: http://127.0.0.1:8888"
  21. fi
  22. fi
  23. if ! [ -z "$WANDB_COMMAND" ]; then
  24. /bin/echo $WANDB_COMMAND >> ~/.bash_history
  25. /bin/echo -e "${wandb}: Command added to history, press up arrow to access it."
  26. /bin/echo -e "${wandb}: $WANDB_COMMAND"
  27. fi
  28. exec "$@"