diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0e1bd64d --- /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 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 -r requirements.txt && 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 diff --git a/README.md b/README.md index 939d93db..d9d4330f 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)
@@ -69,7 +69,7 @@ check if you have GPU acceleration (torch required) ```
-**CPU version** +### CPU version
Mac with Intel chips @@ -92,6 +92,22 @@ Or you prefer to install the pre-built wheel: pip install nexaai --index-url https://nexaai.github.io/nexa-sdk/whl/cpu --extra-index-url https://pypi.org/simple ``` +### 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 ## Model Commands diff --git a/pyproject.toml b/pyproject.toml index 65a3c414..09fede53 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