From 146debac4bb6db5e39ee84476190682543738bf9 Mon Sep 17 00:00:00 2001 From: Yu Xing Date: Wed, 21 Aug 2024 22:54:31 +0000 Subject: [PATCH 1/3] not complete --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..cf843bd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Use a base image that includes Miniconda +FROM continuumio/miniconda3 + +# Set the working directory in the container +WORKDIR /app + +RUN apt-get update && apt-get install -y cmake g++ +# Copy the environment.yml file into the container at /app +COPY pyproject.toml CMakeLists.txt README.md ./ +COPY dependency ./dependency + +# Install the conda environment +RUN conda create -n nexa python=3.10 -y +RUN /bin/bash -c "source activate nexa & pip install build && pip install -e ." + +# Activate the environment +RUN echo "source activate nexa" > ~/.bashrc +ENV PATH /opt/conda/envs/nexa/bin:$PATH + +# Copy your application code to the container +COPY . . + +# Set the command to activate the environment and start your application +CMD ["bash", "-c", "source activate nexa && python -m nexa.cli.entry gen-text gemma"] \ No newline at end of file From ca7f5acac9ed372a19fb309d03286e2b67b8ca1b Mon Sep 17 00:00:00 2001 From: Yu Xing Date: Thu, 22 Aug 2024 00:24:48 +0000 Subject: [PATCH 2/3] runnable docker --- Dockerfile | 4 ++-- pyproject.toml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf843bd3..0e1bd64d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,12 @@ WORKDIR /app RUN apt-get update && apt-get install -y cmake g++ # Copy the environment.yml file into the container at /app -COPY pyproject.toml CMakeLists.txt README.md ./ +COPY pyproject.toml CMakeLists.txt requirements.txt README.md ./ COPY dependency ./dependency # Install the conda environment RUN conda create -n nexa python=3.10 -y -RUN /bin/bash -c "source activate nexa & pip install build && pip install -e ." +RUN /bin/bash -c "source activate nexa && pip install -r requirements.txt && pip install -e ." # Activate the environment RUN echo "source activate nexa" > ~/.bashrc diff --git a/pyproject.toml b/pyproject.toml index 681d4f04..8c22a2fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,6 +80,7 @@ sdist.exclude = [".github", "build", "dist", "nexa.egg-info", "dependency/llama. build.verbose = true cmake.build-type = "Release" cmake.version = ">=3.16" +cmake.args = ["-DCMAKE_CXX_FLAGS=-fopenmp"] [tool.pytest.ini_options] testpaths = ["tests"] \ No newline at end of file From cbaf98a0b3a0844e2c6ec6e9e9169159630a0eb7 Mon Sep 17 00:00:00 2001 From: Yu xing Date: Wed, 21 Aug 2024 21:29:46 -0700 Subject: [PATCH 3/3] update readme --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1716169..76c271d5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Detailed API documentation is available [here](docs/index.html). ## Installation -**GPU version(optional)** +### GPU version(optional) check if you have GPU acceleration (torch required)
@@ -61,7 +61,7 @@ check if you have GPU acceleration (torch required) ```
-**CPU version** +### CPU version
Mac with Intel chips @@ -77,7 +77,20 @@ check if you have GPU acceleration (torch required) ``` pip install nexaai ``` -
+
+ +### Docker Usage +Note: Docker doesn't support GPU acceleration + +``` +docker pull nexa4ai/sdk:latest +# replace following placeholder with your path and command +docker run -v :/model -it nexa4ai/sdk:latest [nexa_command] [your_model_relative_path] +``` +Example: +`docker run -v /home/ubuntu/.cache/nexa/hub/official:/model -it nexa4ai/sdk:latest nexa gen-text /model/Phi-3-mini-128k-instruct/q4_0.gguf` + +will create an interactive session with text generation ## Nexa CLI commands