-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: Build and push QLoRA | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
image_tag: | ||
description: "Tag for the image, e.g. qlora makes qlora-cpu, qlora-cu118, qlora-cu121, and qlora-cu124" | ||
required: false | ||
default: "boltz" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-qlora-cpu: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: boltz/python3.11-slim | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.image_tag }}-cpu | ||
build-args: BASE_IMAGE=python:3.11-slim | ||
build-qlora-cuda118: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: boltz/11.8.0-cudnn8-runtime-ubuntu22.04 | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.image_tag }}-cu118 | ||
build-args: BASE_IMAGE=nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 | ||
build-qlora-cuda121: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: boltz/12.1.0-cudnn8-runtime-ubuntu22.04 | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.image_tag }}-cu121 | ||
build-args: BASE_IMAGE=nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04 | ||
build-qlora-cuda124: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: boltz/12.4.1-cudnn-runtime-ubuntu22.04 | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.image_tag }}-cu124 | ||
build-args: BASE_IMAGE=nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Base image | ||
# ---------------------- | ||
ARG PROJECT_NAME=qlora | ||
ARG PROJECT_URL=https://github.com/artidoro/qlora | ||
ARG BASE_IMAGE=nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 | ||
FROM ${BASE_IMAGE} AS builder | ||
|
||
# Build | ||
# ---------------------- | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
build-essential \ | ||
python3-venv \ | ||
&& python3 -m venv /opt/venv \ | ||
&& . /opt/venv/bin/activate \ | ||
&& git clone https://github.com/artidoro/qlora /app \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 \ | ||
&& pip install --no-cache-dir -r /app/requirements.txt \ | ||
&& apt-get purge -y git build-essential \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Metadata | ||
# ---------------------- | ||
FROM ${BASE_IMAGE} | ||
|
||
LABEL base_image=${BASE_IMAGE} \ | ||
software=${PROJECT_NAME} \ | ||
about.home=${PROJECT_URL} \ | ||
about.summary="QLoRA: Efficient Finetuning of Quantized LLMs" \ | ||
about.tags="Model" \ | ||
about.license="MIT" \ | ||
about.license_file="https://github.com/artidoro/qlora" \ | ||
version="1" | ||
|
||
# Configuration | ||
# ---------------------- | ||
ARG USERNAME=rare | ||
ARG USER_UID=900 | ||
ARG USER_GID=900 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Installation | ||
# ---------------------- | ||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID --create-home --shell /bin/bash $USERNAME | ||
|
||
COPY --from=builder --chown=$USER_UID:$USER_GID /opt/venv /opt/venv | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app /app | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/LICENSE /app/LICENSE | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/README.md /app/README.md | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/docs /app/docs | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/examples /app/examples | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/scripts /app/scripts | ||
|
||
WORKDIR /app | ||
USER $USERNAME | ||
ENTRYPOINT ["qlora"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Base image | ||
# ---------------------- | ||
ARG PROJECT_NAME=qlora | ||
ARG PROJECT_URL=https://github.com/artidoro/qlora | ||
ARG BASE_IMAGE=nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04 | ||
FROM ${BASE_IMAGE} AS builder | ||
|
||
# Build | ||
# ---------------------- | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
build-essential \ | ||
python3-venv \ | ||
&& python3 -m venv /opt/venv \ | ||
&& . /opt/venv/bin/activate \ | ||
&& git clone https://github.com/artidoro/qlora /app \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 \ | ||
&& pip install --no-cache-dir -r /app/requirements.txt \ | ||
&& apt-get purge -y git build-essential \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Metadata | ||
# ---------------------- | ||
FROM ${BASE_IMAGE} | ||
|
||
LABEL base_image=${BASE_IMAGE} \ | ||
software=${PROJECT_NAME} \ | ||
about.home=${PROJECT_URL} \ | ||
about.summary="QLoRA: Efficient Finetuning of Quantized LLMs" \ | ||
about.tags="Model" \ | ||
about.license="MIT" \ | ||
about.license_file="https://github.com/artidoro/qlora" \ | ||
version="1" | ||
|
||
# Configuration | ||
# ---------------------- | ||
ARG USERNAME=rare | ||
ARG USER_UID=900 | ||
ARG USER_GID=900 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Installation | ||
# ---------------------- | ||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID --create-home --shell /bin/bash $USERNAME | ||
|
||
COPY --from=builder --chown=$USER_UID:$USER_GID /opt/venv /opt/venv | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app /app | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/LICENSE /app/LICENSE | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/README.md /app/README.md | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/docs /app/docs | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/examples /app/examples | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/scripts /app/scripts | ||
|
||
WORKDIR /app | ||
USER $USERNAME | ||
ENTRYPOINT ["qlora"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Base image | ||
# ---------------------- | ||
ARG PROJECT_NAME=qlora | ||
ARG PROJECT_URL=https://github.com/artidoro/qlora | ||
ARG BASE_IMAGE=nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 | ||
FROM ${BASE_IMAGE} AS builder | ||
|
||
# Build | ||
# ---------------------- | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
build-essential \ | ||
python3-venv \ | ||
&& python3 -m venv /opt/venv \ | ||
&& . /opt/venv/bin/activate \ | ||
&& git clone https://github.com/artidoro/qlora /app \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 \ | ||
&& pip install --no-cache-dir -r /app/requirements.txt \ | ||
&& apt-get purge -y git build-essential \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Metadata | ||
# ---------------------- | ||
FROM ${BASE_IMAGE} | ||
|
||
LABEL base_image=${BASE_IMAGE} \ | ||
software=${PROJECT_NAME} \ | ||
about.home=${PROJECT_URL} \ | ||
about.summary="QLoRA: Efficient Finetuning of Quantized LLMs" \ | ||
about.tags="Model" \ | ||
about.license="MIT" \ | ||
about.license_file="https://github.com/artidoro/qlora" \ | ||
version="1" | ||
|
||
# Configuration | ||
# ---------------------- | ||
ARG USERNAME=rare | ||
ARG USER_UID=900 | ||
ARG USER_GID=900 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Installation | ||
# ---------------------- | ||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID --create-home --shell /bin/bash $USERNAME | ||
|
||
COPY --from=builder --chown=$USER_UID:$USER_GID /opt/venv /opt/venv | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app /app | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/LICENSE /app/LICENSE | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/README.md /app/README.md | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/docs /app/docs | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/examples /app/examples | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/scripts /app/scripts | ||
|
||
WORKDIR /app | ||
USER $USERNAME | ||
ENTRYPOINT ["qlora"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Base image | ||
# ---------------------- | ||
ARG PROJECT_NAME=qlora | ||
ARG PROJECT_URL=https://github.com/artidoro/qlora | ||
ARG BASE_IMAGE=python:3.11-slim | ||
FROM ${BASE_IMAGE} AS builder | ||
|
||
# Build | ||
# ---------------------- | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
build-essential \ | ||
python3-venv \ | ||
&& python3 -m venv /opt/venv \ | ||
&& . /opt/venv/bin/activate \ | ||
&& git clone https://github.com/artidoro/qlora /app \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \ | ||
&& pip install --no-cache-dir -r /app/requirements.txt \ | ||
&& apt-get purge -y git build-essential \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Metadata | ||
# ---------------------- | ||
FROM ${BASE_IMAGE} | ||
|
||
LABEL base_image=${BASE_IMAGE} \ | ||
software=${PROJECT_NAME} \ | ||
about.home=${PROJECT_URL} \ | ||
about.summary="QLoRA: Efficient Finetuning of Quantized LLMs" \ | ||
about.tags="Model" \ | ||
about.license="MIT" \ | ||
about.license_file="https://github.com/artidoro/qlora" \ | ||
version="1" | ||
|
||
# Configuration | ||
# ---------------------- | ||
ARG USERNAME=rare | ||
ARG USER_UID=900 | ||
ARG USER_GID=900 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Installation | ||
# ---------------------- | ||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID --create-home --shell /bin/bash $USERNAME | ||
|
||
COPY --from=builder --chown=$USER_UID:$USER_GID /opt/venv /opt/venv | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app /app | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/LICENSE /app/LICENSE | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/README.md /app/README.md | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/docs /app/docs | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/examples /app/examples | ||
COPY --from=builder --chown=$USER_UID:$USER_GID /app/scripts /app/scripts | ||
|
||
WORKDIR /app | ||
USER $USERNAME | ||
ENTRYPOINT ["qlora"] |