-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
7329821
commit 3ce7168
Showing
5 changed files
with
81 additions
and
6 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
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,31 @@ | ||
# Base image for the modelcar Granite image | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4 as base | ||
|
||
# Set the HF_TOKEN with --build-arg HF_TOKEN="hf_..." at build time | ||
ARG HF_TOKEN | ||
|
||
# The model repo to download | ||
ENV MODEL_REPO="mistralai/Mistral-7B-Instruct-v0.3" | ||
|
||
# Install necessary Python dependencies | ||
RUN microdnf -y install git git-lfs python3-pip && \ | ||
microdnf clean all | ||
|
||
COPY requirements.txt . | ||
|
||
# Install Hugging Face libraries | ||
RUN pip3 install -r requirements.txt | ||
|
||
COPY download_model.py . | ||
|
||
# Download the necessary model files (config.json, tokenizer.json, and safetensors) | ||
RUN python3 download_model.py | ||
|
||
# Final image containing only the essential model files | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4 | ||
|
||
# Copy only the necessary model files from the base image | ||
COPY --from=base /models /models | ||
|
||
# Set the user to 1001 | ||
USER 1001 |
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,11 @@ | ||
# Granite-3.0-2b-instruct | ||
|
||
https://huggingface.co/ibm-granite/granite-3.0-2b-instruct | ||
|
||
## Building Image | ||
|
||
Once your token has been created, be sure to accept the terms and conditions for this model on the model home page. | ||
|
||
``` | ||
podman build -t redhat-ai-services/modelcar-catalog:granite-3.0-2b-instruct . --build-arg HF_TOKEN="hf_..." | ||
``` |
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,13 @@ | ||
import os | ||
|
||
from huggingface_hub import snapshot_download | ||
|
||
model_repo = os.getenv("MODEL_REPO") | ||
|
||
print(f"Attempting to download the following model from huggingface: {model_repo}") | ||
|
||
snapshot_download( | ||
repo_id=model_repo, | ||
local_dir="/models", | ||
allow_patterns=["*.safetensors", "*.json", "*.txt"], | ||
) |
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,3 @@ | ||
torch | ||
transformers | ||
huggingface-hub |