Skip to content

Commit

Permalink
Merge pull request #358 from rhatdan/instructlab
Browse files Browse the repository at this point in the history
Fixes for configuring training
  • Loading branch information
rhatdan authored Apr 29, 2024
2 parents b148710 + a7cc5e8 commit 5c705b2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
20 changes: 16 additions & 4 deletions training/amd/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ ADD rocm.repo /etc/yum.repos.d/rocm.repo
# Enable CRB repo for CentOS. For RHEL, it should be enabled on the build host
RUN source /etc/os-release \
&& export OS_ID="$ID" \
&& if [ "$OS_ID" == "centos" ]; then \
curl -L https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -o /tmp/epel-release-latest-9.noarch.rpm \
&& rpm -ivh /tmp/epel-release-latest-9.noarch.rpm \
&& rm -f /tmp/epel-release-latest-9.noarch.rpm \
&& if [ "$OS_ID" == "centos" ] || [ "$OS_ID" == "rhel" ]; then \
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
&& dnf install -y 'dnf-command(config-manager)' \
&& crb enable ;\
fi

RUN dnf install -y rocm && dnf clean all

ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-amd:latest"

# Setup /usr/lib/containers/storage as an additional store for images.
# Remove once the base images have this set by default.
RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \
/etc/containers/storage.conf

# Added for running as an OCI Container to prevent Overlay on Overlay issues.
VOLUME /var/lib/containers

# Prepull the instructlab image

RUN podman pull --arch=${TARGETARCH} --root /usr/lib/containers/storage ${INSTRUCTLAB_IMAGE}
6 changes: 6 additions & 0 deletions training/amd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ CONTAINER_TOOL_EXTRA_ARGS ?=
.PHONY: image
image:
"${CONTAINER_TOOL}" build \
--security-opt label=disable \
--cap-add SYS_ADMIN \
--file Containerfile \
--tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \
$(FROM:%=--from=%) \
${CONTAINER_TOOL_EXTRA_ARGS}

.PHONY: push
push:
podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}"
4 changes: 4 additions & 0 deletions training/intel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ image:
$(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \
$(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \
${CONTAINER_TOOL_EXTRA_ARGS}

.PHONY: push
push:
podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}"
14 changes: 14 additions & 0 deletions training/nvidia/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,17 @@ RUN if [ "${TARGET_ARCH}" == "" ]; then \
&& dnf clean all \
&& ln -s /usr/lib/systemd/system/nvidia-toolkit-firstboot.service /usr/lib/systemd/system/basic.target.wants/nvidia-toolkit-firstboot.service \
&& echo "blacklist nouveau" > /etc/modprobe.d/blacklist_nouveau.conf

ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-nvidia:latest"

# Setup /usr/lib/containers/storage as an additional store for images.
# Remove once the base images have this set by default.
RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \
/etc/containers/storage.conf

# Added for running as an OCI Container to prevent Overlay on Overlay issues.
VOLUME /var/lib/containers

# Prepull the instructlab image

RUN podman pull --arch=${TARGETARCH} --root /usr/lib/containers/storage ${INSTRUCTLAB_IMAGE}
6 changes: 6 additions & 0 deletions training/nvidia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dtk:
.
image:
"${CONTAINER_TOOL}" build \
--security-opt label=disable \
--cap-add SYS_ADMIN \
$(ARCH:%=--platform linux/%) \
--file Containerfile \
--tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \
Expand All @@ -43,3 +45,7 @@ image:
$(CUDA_VERSION:%=--build-arg CUDA_VERSION=%) \
${CONTAINER_TOOL_EXTRA_ARGS} \
.

.PHONY: push
push:
podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}"

0 comments on commit 5c705b2

Please sign in to comment.