Skip to content

Commit 244ace1

Browse files
authored
model-conversion : fix mmproj output file name [no ci] (ggml-org#22274)
* model-conversion : fix mmproj output file name [no ci] This commit updates the convert-model.sh script to properly handle mmproj output files. The motivation for this that currently the same name as the original model is used as the mmproj file, which causes the original model to be overwritten and no mmproj-<model_name>.gguf to be created. * model-conversion : use MODEL_NAME [no ci]
1 parent 5e6ff2e commit 244ace1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

examples/model-conversion/scripts/causal/convert-model.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ MODEL_NAME="${MODEL_NAME:-$(basename "$MODEL_PATH")}"
2525
OUTPUT_DIR="${OUTPUT_DIR:-../../models}"
2626
TYPE="${OUTTYPE:-f16}"
2727
METADATA_OVERRIDE="${METADATA_OVERRIDE:-}"
28-
CONVERTED_MODEL="${OUTPUT_DIR}/${MODEL_NAME}.gguf"
28+
if [[ -n "$MMPROJ" ]]; then
29+
CONVERTED_MODEL="${OUTPUT_DIR}/mmproj-${MODEL_NAME}.gguf"
30+
else
31+
CONVERTED_MODEL="${OUTPUT_DIR}/${MODEL_NAME}.gguf"
32+
fi
2933

3034
echo "Model path: ${MODEL_PATH}"
3135
echo "Model name: ${MODEL_NAME}"
@@ -38,6 +42,7 @@ if [[ -n "$DEBUG" ]]; then
3842
else
3943
CMD_ARGS=("python")
4044
fi
45+
4146
CMD_ARGS+=("../../convert_hf_to_gguf.py" "--verbose")
4247
CMD_ARGS+=("${MODEL_PATH}")
4348
CMD_ARGS+=("--outfile" "${CONVERTED_MODEL}")
@@ -50,7 +55,3 @@ CMD_ARGS+=("--outtype" "${TYPE}")
5055
echo ""
5156
echo "The environment variable CONVERTED_MODEL can be set to this path using:"
5257
echo "export CONVERTED_MODEL=$(realpath ${CONVERTED_MODEL})"
53-
if [[ -n "$MMPROJ" ]]; then
54-
mmproj_file="${OUTPUT_DIR}/mmproj-$(basename "${CONVERTED_MODEL}")"
55-
echo "The mmproj model was created in $(realpath "$mmproj_file")"
56-
fi

0 commit comments

Comments
 (0)