From 4961009887e1addcf7399fbffc97924613e067e5 Mon Sep 17 00:00:00 2001 From: extio-de Date: Sun, 20 Oct 2024 20:53:53 +0200 Subject: [PATCH] initial commit --- Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + convert_to_gguf.sh | 15 +++++++++++++++ run.sh | 3 +++ setup.sh | 4 ++++ 5 files changed, 66 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 convert_to_gguf.sh create mode 100755 run.sh create mode 100644 setup.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..423d827 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM rocm/pytorch:rocm6.2.3_ubuntu22.04_py3.10_pytorch_release_2.3.0 AS base-builder + +ENV DISTFILES_TAG=v1 +ENV GPU_ARCHS="gfx1100" +ENV ROCM_TARGET="gfx1100" +ENV HIP_PLATFORM=amd +ENV DS_BUILD_CPU_ADAM=1 +ENV TORCH_HIP_ARCH_LIST="gfx1100" + +RUN apt-get update +RUN apt-get install -y wget git build-essential ninja-build git-lfs libaio-dev cmake +RUN git lfs install +RUN apt-get install -y --allow-change-held-packages vim curl nano rsync s3fs +RUN apt-get install -y libjpeg-dev python3-dev python3-pip + +WORKDIR /workspace +#RUN git clone --recurse https://github.com/ROCm/bitsandbytes.git +RUN git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git +WORKDIR /workspace/bitsandbytes +#RUN git checkout rocm_enabled +RUN pip install -r /workspace/bitsandbytes/requirements-dev.txt +RUN cmake -DBNB_ROCM_ARCH="gfx1100" -DCOMPUTE_BACKEND=hip -S . +RUN make +RUN git tag 0.44.2 +RUN pip install . + +WORKDIR /workspace +RUN pip install trl +RUN pip install peft +RUN pip install transformers datasets huggingface-hub scipy + +RUN git clone https://github.com/ggerganov/llama.cpp.git +WORKDIR /workspace/llama.cpp +RUN make -j32 GGML_HIPBLAS=1 AMDGPU_TARGETS=gfx1100 +RUN pip install -r requirements/requirements-convert_legacy_llama.txt + +WORKDIR /workspace +COPY convert_to_gguf.sh /workspace/convert_to_gguf.sh +RUN chmod +x /workspace/convert_to_gguf.sh +COPY setup.sh /workspace/setup.sh +RUN chmod +x /workspace/setup.sh + +ENTRYPOINT ["/workspace/setup.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..4cf5512 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# lm-container diff --git a/convert_to_gguf.sh b/convert_to_gguf.sh new file mode 100644 index 0000000..e302f65 --- /dev/null +++ b/convert_to_gguf.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [[ $# -ne 2 ]] ; then + echo 'Arguments: ' + exit 1 +fi + +cd /workspace/llama.cpp +./convert_hf_to_gguf.py --model-name $2 $1 +./llama-quantize $1/*-F16.gguf Q8_0 +./llama-quantize $1/*-F16.gguf Q6_K +./llama-quantize $1/*-F16.gguf Q5_K_M +./llama-quantize $1/*-F16.gguf Q4_K_M +./llama-quantize $1/*-F16.gguf Q4_0_4_4 +./llama-quantize $1/*-F16.gguf IQ3_M diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..8db2f9b --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run --device=/dev/kfd --device=/dev/dri --privileged --security-opt seccomp=unconfined --group-add video --shm-size 20g --rm -it --name axolotl --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --mount type=bind,src="/home/sb/lm/",target=/workspace/data --mount type=bind,src="/home/sb/svn/lm-finetuner/",target=/workspace/lm-finetuner pytorch-rocm-exo:v1 diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..245e6f7 --- /dev/null +++ b/setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo Ready +/bin/bash