1
0

install_osx.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/usr/bin/env bash
  2. INSTALL_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
  3. ROOT_DIR="${INSTALL_SCRIPT_DIR}/.."
  4. printf "Detecting OS: "
  5. if [ "$(uname)" == "Darwin" ]; then
  6. printf "\e[32mOSX\e[m\n"
  7. else
  8. printf "\e[31m${$(uname)}\e[m\n"
  9. printf "\e[31mERROR:\e[m This script only works on OSX\n"
  10. exit 1
  11. fi
  12. echo "Root directory: ${ROOT_DIR}"
  13. printf "Detecting brew: "
  14. if command -v brew &> /dev/null; then
  15. printf "\e[32mfound\e[m\n"
  16. else
  17. printf "\e[31mnot found\e[m\n"
  18. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  19. fi
  20. printf "Detecting git: "
  21. if command -v git &> /dev/null; then
  22. printf "\e[32mfound\e[m\n"
  23. else
  24. printf "\e[31mnot found\e[m\n"
  25. brew install git
  26. fi
  27. printf "Detecting nvm: "
  28. if [ -d "${HOME}/.nvm/.git" ]; then
  29. printf "\e[32mfound\e[m\n"
  30. else
  31. printf "\e[31mnot found\e[m\n"
  32. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh)"
  33. exit 1
  34. fi
  35. echo "Building amica"
  36. cd "${ROOT_DIR}"
  37. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  38. nvm install
  39. nvm use
  40. npm install
  41. npm run build
  42. mkdir -p "${ROOT_DIR}/working"
  43. if [ -d "${ROOT_DIR}/working/llama.cpp" ]; then
  44. echo "Llama.cpp exists"
  45. else
  46. git clone https://github.com/ggerganov/llama.cpp "${ROOT_DIR}/working/llama.cpp"
  47. fi
  48. echo "Building llama.cpp"
  49. cd "${ROOT_DIR}/working/llama.cpp"
  50. make server -j
  51. echo "Downloading OpenChat 3.5"
  52. curl -L "https://huggingface.co/TheBloke/openchat_3.5-GGUF/resolve/main/openchat_3.5.Q5_K_M.gguf?download=true" -o "${ROOT_DIR}/working/llama.cpp/models/openchat_3.5.Q5_K_M.gguf"
  53. if [ -d "${ROOT_DIR}/working/basic-openai-api-weapper" ]
  54. then
  55. echo "basic-openai-api-wrapper exists"
  56. else
  57. git clone https://github.com/semperai/basic-openai-api-wrapper.git "${ROOT_DIR}/working/basic-openai-api-wrapper"
  58. fi
  59. echo "Building basic-openai-api-wrapper"
  60. cd "${ROOT_DIR}/working/basic-openai-api-wrapper"
  61. python3 -m venv venv
  62. source venv/bin/activate
  63. pip install -r requirements.txt