Skip to content

Commit 0276221

Browse files
RHDHPAI-1009: Choose a model from the model catalog (#89)
* choose a model from the model catalog path added to skeleton Signed-off-by: Michael Valdron <[email protected]> * UI revisions to templates Signed-off-by: Michael Valdron <[email protected]> * add SUPPORT_EXISTING env var to toggle existing model server grouping Signed-off-by: Michael Valdron <[email protected]> * add grouping changes and additional steps to parse ai-model catalog entity for model server values for GitOps template Signed-off-by: Michael Valdron <[email protected]> * sync changes to software template entries Signed-off-by: Michael Valdron <[email protected]> * change fetching model api to fetching model-server Signed-off-by: Michael Valdron <[email protected]> * fix: unquote modelName evaluation Signed-off-by: Michael Valdron <[email protected]> * fix: correct ternary statement for setting the model name Signed-off-by: Michael Valdron <[email protected]> * sync changes to software template entries Signed-off-by: Michael Valdron <[email protected]> * feedback: set help text based on model server choice Signed-off-by: Michael Valdron <[email protected]> * feedback: revise naming of existing model server entries Signed-off-by: Michael Valdron <[email protected]> * fix: change help text for 'Bring you own model server' based on model support Signed-off-by: Michael Valdron <[email protected]> * pick from model-server entities instead if using 'Automatic Speech Recognition' or 'Detection Transformer (DETR)' model supported templates Signed-off-by: Michael Valdron <[email protected]> * fix: mention 'model server' instead of 'model' under 'Choose from the Catalog model server(s)' help text if template is non-LLM supported Signed-off-by: Michael Valdron <[email protected]> * fix: require catalogModelServer instead of catalogModel if non-LLM supported Signed-off-by: Michael Valdron <[email protected]> * fix yaml formatting errors Signed-off-by: Michael Valdron <[email protected]> * darwin fix Signed-off-by: Michael Valdron <[email protected]> * fix: adjust darwin sed fix Signed-off-by: Michael Valdron <[email protected]> * filter ai-model entities on existence of model-server parent Signed-off-by: Michael Valdron <[email protected]> * use model-server annotation for model endpoint field Signed-off-by: Michael Valdron <[email protected]> * fix: exclude all choose model server choices from model-server (no app) template Signed-off-by: Michael Valdron <[email protected]> * fix: UI revision and action conditions fixed Signed-off-by: Michael Valdron <[email protected]> * fix: sed command for darwin under update-tekton-definition script Signed-off-by: Michael Valdron <[email protected]> --------- Signed-off-by: Michael Valdron <[email protected]>
1 parent 1fbce71 commit 0276221

File tree

11 files changed

+540
-121
lines changed

11 files changed

+540
-121
lines changed

scripts/envs/base

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export SUPPORT_ASR=false
1313
export SUPPORT_DETR=false
1414

1515
# model server configuration
16+
export SUPPORT_EXISTING=true
1617
export SUPPORT_EXISTING_SERVER=true
18+
export SUPPORT_MODEL_CATALOG=false
1719

1820
# Database configurations
1921
export SUPPORT_DB=false

scripts/envs/model-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export SUPPORT_LLM=true
2424
export SUPPORT_LLM_LLAMA=false
2525

2626
# model server configuration
27-
export SUPPORT_EXISTING_SERVER=false
27+
export SUPPORT_EXISTING=false
2828

2929
# application configuration
3030
export SUPPORT_APP=false

scripts/update-tekton-definition

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ git clone $REPO 2>&1 > /dev/null
1717
(cd $REPONAME; git checkout $BRANCH; git pull)
1818

1919
function add-backstage-labels () {
20-
FILE_NAME=$1
21-
# replace {{values.rawUrl}} to the current commit's URL
22-
sed -i "s!{{values.rawUrl}}!$RAW_BASE!g" $FILE_NAME
23-
sed -i "s!{{ values!\${{ values!g" $FILE_NAME
20+
FILE_NAME=$1
21+
22+
# if using darwin (macos)
23+
if ! sed --version >/dev/null 2>&1; then
24+
# replace {{values.rawUrl}} to the current commit's URL
25+
sed -i '' "s!{{values.rawUrl}}!$RAW_BASE!g" $FILE_NAME
26+
sed -i '' "s!{{ values!\${{ values!g" $FILE_NAME
27+
# if using linux
28+
else
29+
# replace {{values.rawUrl}} to the current commit's URL
30+
sed -i "s!{{values.rawUrl}}!$RAW_BASE!g" $FILE_NAME
31+
sed -i "s!{{ values!\${{ values!g" $FILE_NAME
32+
fi
33+
2434
# add labels for RHDH
2535
yq -i '(. | .metadata.labels += { "argocd/app-name": "${{ values.name }}",
2636
"janus-idp.io/tekton": "${{ values.name }}",

scripts/util

Lines changed: 82 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,90 @@ function apply-configurations() {
3131
# get sample env variables
3232
source $SCRIPTDIR/envs/$SAMPLENAME
3333

34-
if [ -f $f/Containerfile ]; then
35-
sed -i "s!sed.edit.DOCKERFILE!Containerfile!g" $DEST/template.yaml
36-
sed -i "s!sed.edit.BUILDCONTEXT!.!g" $DEST/template.yaml
37-
fi
34+
# if using darwin (macos)
35+
if ! sed --version >/dev/null 2>&1; then
36+
if [ -f $f/Containerfile ]; then
37+
sed -i '' "s!sed.edit.DOCKERFILE!Containerfile!g" $DEST/template.yaml
38+
sed -i '' "s!sed.edit.BUILDCONTEXT!.!g" $DEST/template.yaml
39+
fi
3840

39-
sed -i "s!sed.edit.APP_NAME!$APP_NAME!g" $DEST/template.yaml
40-
sed -i "s!sed.edit.APP_DISPLAY_NAME!$APP_DISPLAY_NAME!g" $DEST/template.yaml
41-
sed -i "s!sed.edit.DESCRIPTION!$APP_DESC!g" $DEST/template.yaml
42-
sed -i "s!sed.edit.APPTAGS!$APP_TAGS!g" $DEST/template.yaml
43-
sed -i "s!sed.edit.CATALOG_DESCRIPTION!Secure Supply Chain Example for $APP_DISPLAY_NAME!g" $DEST/template.yaml
44-
sed -i "s!sed.edit.OWNER!$OWNER!g" $DEST/template.yaml
41+
sed -i '' "s!sed.edit.APP_NAME!$APP_NAME!g" $DEST/template.yaml
42+
sed -i '' "s!sed.edit.APP_DISPLAY_NAME!$APP_DISPLAY_NAME!g" $DEST/template.yaml
43+
sed -i '' "s!sed.edit.DESCRIPTION!$APP_DESC!g" $DEST/template.yaml
44+
sed -i '' "s!sed.edit.APPTAGS!$APP_TAGS!g" $DEST/template.yaml
45+
sed -i '' "s!sed.edit.CATALOG_DESCRIPTION!Secure Supply Chain Example for $APP_DISPLAY_NAME!g" $DEST/template.yaml
46+
sed -i '' "s!sed.edit.OWNER!$OWNER!g" $DEST/template.yaml
4547

46-
if [ $SUPPORT_APP == false ]; then
47-
sed -i '/# SED_APP_SUPPORT_START/,/# SED_APP_SUPPORT_END/d' $DEST/template.yaml
48-
fi
49-
if [ $SUPPORT_LLM == false ]; then
50-
sed -i '/# SED_LLM_SERVER_START/,/# SED_LLM_SERVER_END/d' $DEST/template.yaml
51-
fi
52-
if [ $SUPPORT_LLM_LLAMA == false ]; then
53-
sed -i '/# SED_LLM_LLAMA_SERVER_START/,/# SED_LLM_LLAMA_SERVER_END/d' $DEST/template.yaml
54-
sed -i 's/llama.cpp: ${MODEL_SERVICE_DESC}. | \[Learn more\][(]${MODEL_SERVICE_SRC}[)]//' $DEST/template.yaml
55-
fi
56-
if [ $SUPPORT_ASR == false ]; then
57-
sed -i '/# SED_ASR_MODEL_SERVER_START/,/# SED_ASR_MODEL_SERVER_END/d' $DEST/template.yaml
58-
fi
59-
if [ $SUPPORT_DETR == false ]; then
60-
sed -i '/# SED_DETR_MODEL_SERVER_START/,/# SED_DETR_MODEL_SERVER_END/d' $DEST/template.yaml
61-
fi
62-
if [ $SUPPORT_DB == false ]; then
63-
sed -i '/# SED_DB_START/,/# SED_DB_END/d' $DEST/template.yaml
64-
fi
65-
if [ $SUPPORT_EXISTING_SERVER == false ]; then
66-
sed -i '/# SED_EXISTING_SERVER_START/,/# SED_EXISTING_SERVER_END/d' $DEST/template.yaml
48+
if [ $SUPPORT_APP == false ]; then
49+
sed -i '' '/# SED_APP_SUPPORT_START/,/# SED_APP_SUPPORT_END/d' $DEST/template.yaml
50+
fi
51+
if [ $SUPPORT_LLM == false ]; then
52+
sed -i '' '/# SED_LLM_SERVER_START/,/# SED_LLM_SERVER_END/d' $DEST/template.yaml
53+
fi
54+
if [ $SUPPORT_LLM_LLAMA == false ]; then
55+
sed -i '' '/# SED_LLM_LLAMA_SERVER_START/,/# SED_LLM_LLAMA_SERVER_END/d' $DEST/template.yaml
56+
sed -i '' 's/llama.cpp: ${MODEL_SERVICE_DESC}. | \[Learn more\][(]${MODEL_SERVICE_SRC}[)]//' $DEST/template.yaml
57+
fi
58+
if [ $SUPPORT_ASR == false ]; then
59+
sed -i '' '/# SED_ASR_MODEL_SERVER_START/,/# SED_ASR_MODEL_SERVER_END/d' $DEST/template.yaml
60+
fi
61+
if [ $SUPPORT_DETR == false ]; then
62+
sed -i '' '/# SED_DETR_MODEL_SERVER_START/,/# SED_DETR_MODEL_SERVER_END/d' $DEST/template.yaml
63+
fi
64+
if [ $SUPPORT_DB == false ]; then
65+
sed -i '' '/# SED_DB_START/,/# SED_DB_END/d' $DEST/template.yaml
66+
fi
67+
if [ $SUPPORT_EXISTING == false ]; then
68+
sed -i '' '/# SED_EXISTING_START/,/# SED_EXISTING_END/d' $DEST/template.yaml
69+
fi
70+
if [ $SUPPORT_EXISTING_SERVER == false ]; then
71+
sed -i '' '/# SED_EXISTING_SERVER_START/,/# SED_EXISTING_SERVER_END/d' $DEST/template.yaml
72+
fi
73+
if [ $SUPPORT_MODEL_CATALOG == false ]; then
74+
sed -i '' '/# SED_EXISTING_FROM_CATALOG_START/,/# SED_EXISTING_FROM_CATALOG_END/d' $DEST/template.yaml
75+
fi
76+
# if using linux
77+
else
78+
if [ -f $f/Containerfile ]; then
79+
sed -i "s!sed.edit.DOCKERFILE!Containerfile!g" $DEST/template.yaml
80+
sed -i "s!sed.edit.BUILDCONTEXT!.!g" $DEST/template.yaml
81+
fi
82+
83+
sed -i "s!sed.edit.APP_NAME!$APP_NAME!g" $DEST/template.yaml
84+
sed -i "s!sed.edit.APP_DISPLAY_NAME!$APP_DISPLAY_NAME!g" $DEST/template.yaml
85+
sed -i "s!sed.edit.DESCRIPTION!$APP_DESC!g" $DEST/template.yaml
86+
sed -i "s!sed.edit.APPTAGS!$APP_TAGS!g" $DEST/template.yaml
87+
sed -i "s!sed.edit.CATALOG_DESCRIPTION!Secure Supply Chain Example for $APP_DISPLAY_NAME!g" $DEST/template.yaml
88+
sed -i "s!sed.edit.OWNER!$OWNER!g" $DEST/template.yaml
89+
90+
if [ $SUPPORT_APP == false ]; then
91+
sed -i '/# SED_APP_SUPPORT_START/,/# SED_APP_SUPPORT_END/d' $DEST/template.yaml
92+
fi
93+
if [ $SUPPORT_LLM == false ]; then
94+
sed -i '/# SED_LLM_SERVER_START/,/# SED_LLM_SERVER_END/d' $DEST/template.yaml
95+
fi
96+
if [ $SUPPORT_LLM_LLAMA == false ]; then
97+
sed -i '/# SED_LLM_LLAMA_SERVER_START/,/# SED_LLM_LLAMA_SERVER_END/d' $DEST/template.yaml
98+
sed -i 's/llama.cpp: ${MODEL_SERVICE_DESC}. | \[Learn more\][(]${MODEL_SERVICE_SRC}[)]//' $DEST/template.yaml
99+
fi
100+
if [ $SUPPORT_ASR == false ]; then
101+
sed -i '/# SED_ASR_MODEL_SERVER_START/,/# SED_ASR_MODEL_SERVER_END/d' $DEST/template.yaml
102+
fi
103+
if [ $SUPPORT_DETR == false ]; then
104+
sed -i '/# SED_DETR_MODEL_SERVER_START/,/# SED_DETR_MODEL_SERVER_END/d' $DEST/template.yaml
105+
fi
106+
if [ $SUPPORT_DB == false ]; then
107+
sed -i '/# SED_DB_START/,/# SED_DB_END/d' $DEST/template.yaml
108+
fi
109+
if [ $SUPPORT_EXISTING == false ]; then
110+
sed -i '/# SED_EXISTING_START/,/# SED_EXISTING_END/d' $DEST/template.yaml
111+
fi
112+
if [ $SUPPORT_EXISTING_SERVER == false ]; then
113+
sed -i '/# SED_EXISTING_SERVER_START/,/# SED_EXISTING_SERVER_END/d' $DEST/template.yaml
114+
fi
115+
if [ $SUPPORT_MODEL_CATALOG == false ]; then
116+
sed -i '/# SED_EXISTING_FROM_CATALOG_START/,/# SED_EXISTING_FROM_CATALOG_END/d' $DEST/template.yaml
117+
fi
67118
fi
68119

69120
source $ROOT_DIR/properties

0 commit comments

Comments
 (0)