Skip to content

Commit

Permalink
Merge pull request #398 from containers/magma
Browse files Browse the repository at this point in the history
add model container builder
  • Loading branch information
kwozyman authored Apr 30, 2024
2 parents bece6e6 + fc2fe7a commit b368f52
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions training/model/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM registry.access.redhat.com/ubi9/ubi

ARG MODEL_REPO=''
ARG MODEL_NAME=''
ARG MODEL_PATH=''

RUN dnf install -y python3-pip && python3 -m pip install huggingface_hub
RUN mkdir -p "${MODEL_PATH}" \
&& echo from huggingface_hub import snapshot_download > /root/hf_download \
&& echo snapshot_download\(repo_id=\'${MODEL_REPO}\', local_dir=\'${MODEL_PATH}\', local_dir_use_symlinks=False\) >> /root/hf_download \
&& python3 /root/hf_download
22 changes: 22 additions & 0 deletions training/model/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ?=

REGISTRY ?= quay.io
REGISTRY_ORG ?= ai-lab
IMAGE_NAME ?= granite-7b-lab
IMAGE_TAG ?= latest

CONTAINER_TOOL ?= podman
CONTAINER_TOOL_EXTRA_ARGS ?=

MODEL_REPO ?= ibm/granite-7b-base
MODEL_PATH ?= /usr/share/ai-model

.PHONY: image
image:
"${CONTAINER_TOOL}" build \
--file Containerfile \
--tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \
$(FROM:%=--build-arg BASEIMAGE=%) \
$(MODEL_REPO:%=--build-arg MODEL_REPO=%) \
$(MODEL_PATH:%=--build-arg MODEL_PATH=%) \
${CONTAINER_TOOL_EXTRA_ARGS}

0 comments on commit b368f52

Please sign in to comment.