@@ -195,7 +195,7 @@ case "$HF_MODEL" in
195195 PREPROCESSOR_FEATURE_SIZE=" "
196196 PREPROCESSOR_OUTPUT=" "
197197 ;;
198- SocialLocalMobile /gemma-4-31B-it-HQQ-INT4 )
198+ unsloth /gemma-4-31B-it-GGUF )
199199 MODEL_NAME=" gemma4_31b"
200200 TASK=" "
201201 MAX_SEQ_LEN=" "
@@ -205,7 +205,7 @@ case "$HF_MODEL" in
205205 ;;
206206 * )
207207 echo " Error: Unsupported model '$HF_MODEL '"
208- echo " Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4, SocialLocalMobile /gemma-4-31B-it-HQQ-INT4 "
208+ echo " Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4, unsloth /gemma-4-31B-it-GGUF "
209209 exit 1
210210 ;;
211211esac
@@ -469,22 +469,28 @@ if [ "$MODEL_NAME" = "qwen3_5_moe" ]; then
469469 exit 0
470470fi
471471
472- # Gemma 4 31B uses a prequantized checkpoint and custom export script
472+ # Gemma 4 31B: download the Q4_K_M GGUF and export via the GGUF loader
473473if [ " $MODEL_NAME " = " gemma4_31b" ]; then
474474 pip install safetensors huggingface_hub gguf
475475
476- # Download prequantized model outside OUTPUT_DIR to avoid uploading on failure
476+ # Download GGUF + tokenizer outside OUTPUT_DIR to avoid uploading on failure.
477+ # The unsloth GGUF repo ships the .gguf but no tokenizer.json, so the tokenizer
478+ # is fetched from the (non-GGUF) unsloth/gemma-4-31B-it repo.
477479 LOCAL_MODEL_DIR=$( mktemp -d)
478480 INDUCTOR_CACHE=$( mktemp -d " ${RUNNER_TEMP:-/ tmp} /inductor_cache_XXXXXX" )
479481 INDUCTOR_TMPDIR=$( mktemp -d " ${RUNNER_TEMP:-/ tmp} /tmpdir_XXXXXX" )
480482 trap ' rm -rf "$LOCAL_MODEL_DIR" "$INDUCTOR_CACHE" "$INDUCTOR_TMPDIR"' EXIT
481483
482- python -c " from huggingface_hub import snapshot_download; snapshot_download('${HF_MODEL} ', local_dir='${LOCAL_MODEL_DIR} ')"
484+ GGUF_FILE=" gemma-4-31B-it-Q4_K_M.gguf"
485+ python -c " from huggingface_hub import hf_hub_download; hf_hub_download('unsloth/gemma-4-31B-it-GGUF', '${GGUF_FILE} ', local_dir='${LOCAL_MODEL_DIR} ')"
486+ python -c " from huggingface_hub import hf_hub_download; hf_hub_download('unsloth/gemma-4-31B-it', 'tokenizer.json', local_dir='${LOCAL_MODEL_DIR} ')"
487+ GGUF_PATH=" ${LOCAL_MODEL_DIR} /${GGUF_FILE} "
483488
484- # Sanity check: run inference on the prequantized model
489+ # Sanity check: run inference on the GGUF model
485490 echo " ::group::Inference sanity check"
486491 INFERENCE_OUTPUT=$( python -m executorch.examples.models.gemma4_31b.inference \
487- --prequantized " $LOCAL_MODEL_DIR " \
492+ --gguf " $GGUF_PATH " \
493+ --tokenizer-path " ${LOCAL_MODEL_DIR} /tokenizer.json" \
488494 --prompt " What is the capital of France?" \
489495 --max-new-tokens 32 \
490496 --temperature 0 \
@@ -497,14 +503,14 @@ if [ "$MODEL_NAME" = "gemma4_31b" ]; then
497503 echo " ::endgroup::"
498504
499505 # Copy tokenizer for the runner
500- cp " $LOCAL_MODEL_DIR /tokenizer.json" " ${OUTPUT_DIR} /tokenizer.json"
506+ cp " ${ LOCAL_MODEL_DIR} /tokenizer.json" " ${OUTPUT_DIR} /tokenizer.json"
501507
502508 # Export to .pte/.ptd (short cache dir avoids objcopy symbol length issues)
503509 echo " ::group::Export"
504510 TMPDIR=" $INDUCTOR_TMPDIR " \
505511 TORCHINDUCTOR_CACHE_DIR=" $INDUCTOR_CACHE " \
506512 python -m executorch.examples.models.gemma4_31b.export \
507- --prequantized " $LOCAL_MODEL_DIR " \
513+ --gguf " $GGUF_PATH " \
508514 --output-dir " ${OUTPUT_DIR} "
509515 echo " ::endgroup::"
510516
0 commit comments