mlnet 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. case "${OSTYPE}" in
  5. msys*) python="winpty python";;
  6. *) python=python3;;
  7. esac
  8. bold() {
  9. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  10. }
  11. clean() {
  12. bold "mlnet clean"
  13. rm -rf "./third_party/src/mlnet"
  14. }
  15. sync() {
  16. bold "mlnet sync"
  17. [ -d "./third_party/src/mlnet" ] || git clone --quiet --recursive https://github.com/dotnet/machinelearning.git "./third_party/src/mlnet"
  18. pushd "./third_party/src/mlnet" > /dev/null
  19. git pull --quiet --prune
  20. git submodule sync --quiet
  21. git submodule update --quiet --init --recursive
  22. popd > /dev/null
  23. }
  24. metadata() {
  25. bold "mlnet metadata"
  26. export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
  27. ${python} ./tools/mlnet-script.py metadata
  28. }
  29. while [ "$#" != 0 ]; do
  30. command="$1" && shift
  31. case "${command}" in
  32. "clean") clean;;
  33. "sync") sync;;
  34. "metadata") metadata;;
  35. esac
  36. done