Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model container builder #398

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Gregory-Pereira marked this conversation as resolved.
Show resolved Hide resolved
.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}