From d4077f70dba8ad22d5809ebd2e5b9c4e5a08694c Mon Sep 17 00:00:00 2001 From: drbh Date: Fri, 26 Apr 2024 00:29:43 +0000 Subject: [PATCH] feat: add one line quickstart --- .gitignore | 3 +++ quickstart.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 quickstart.sh diff --git a/.gitignore b/.gitignore index b3ca772b..112b2f14 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ server/exllama_kernels/exllama_kernels/hip_func/ *_hip.cuh server/exllama_kernels/exllama_kernels/hip_buffers.cuh server/exllama_kernels/exllama_kernels/exllama_ext_hip.cpp + +# ignore default docker directory +data/ diff --git a/quickstart.sh b/quickstart.sh new file mode 100644 index 00000000..42226488 --- /dev/null +++ b/quickstart.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Check if Docker is installed +if ! command -v docker &> /dev/null; then + # Install Docker based on the OS + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Ubuntu/Debian-based systems + sudo apt-get update && sudo apt-get install -y docker.io + elif [[ "$OSTYPE" == "darwin"* ]]; then + # macOS (using Homebrew) + brew install --cask docker + elif [[ "$OSTYPE" == "msys"* ]]; then + # Windows (using Chocolatey) + choco install docker-desktop + else + echo "Unsupported OS: $OSTYPE" + exit 1 + fi +fi + +# Install NVIDIA Container Toolkit (only if on Linux) +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit +elif [[ "$OSTYPE" == "darwin"* ]]; then + # Currently, NVIDIA Container Toolkit does not support macOS, so warn the user. + echo "NVIDIA Container Toolkit is not available for macOS." + exit 1 +elif [[ "$OSTYPE" == "msys"* ]]; then + # Currently, NVIDIA Container Toolkit does not support Windows directly. + echo "NVIDIA Container Toolkit is not available for Windows. Ensure Docker Desktop WSL 2 backend is enabled." +fi + +# Set variables for the Docker container +model="HuggingFaceH4/zephyr-7b-beta" +volume="$PWD/data" + +# Run the Docker container in interactive mode to allow CTRL+C to stop the container +docker run -it --gpus all --shm-size 1g -p 8080:80 -v "$volume:/data" ghcr.io/huggingface/text-generation-inference:2.0 --model-id "$model"