Skip to content

Commit 9915faf

Browse files
Lora fix (#19304)
number of think tokens is a little flakey and I dont think its super material for now so relaxing
1 parent 83ac75c commit 9915faf

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

.ci/scripts/test_lora.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ cleanup_files() {
3333
rm result*.txt
3434
}
3535

36+
matches_base_response_prefix() {
37+
local output_file="$1"
38+
python - "$output_file" <<'PY'
39+
import pathlib
40+
import re
41+
import sys
42+
43+
text = pathlib.Path(sys.argv[1]).read_text()
44+
pattern = re.compile(
45+
r"^<\|im_start\|>user Calculate 15% of 80\?<\|im_end\|><\|im_start\|>assistant:\n"
46+
r"(?:<think>\n)+"
47+
r"Okay, so I need to calculate 15% of 80\.",
48+
re.MULTILINE,
49+
)
50+
sys.exit(0 if pattern.match(text) else 1)
51+
PY
52+
}
53+
3654
# Hosting lora adapter in personal repo for now.
3755
python -m pip install -q huggingface_hub
3856
HF_ADAPTER_REPO="lucylq/qwen3_06B_lora_math"
@@ -186,7 +204,7 @@ cmake-out/examples/models/llama/llama_main --model_path=qwen_q.pte --data_paths=
186204
NOW=$(date +"%H:%M:%S")
187205
echo "Finished at ${NOW}"
188206
RESULT=$(cat result.txt)
189-
if [[ "${RESULT}" == "${EXPECTED_QUANT_PREFIX}"* ]]; then
207+
if matches_base_response_prefix result.txt; then
190208
echo "Expected result prefix: ${EXPECTED_QUANT_PREFIX}"
191209
echo "Actual result: ${RESULT}"
192210
echo "Test 3: Success"

.ci/scripts/test_lora_multimethod.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ cleanup_files() {
3333
rm -f result*.txt
3434
}
3535

36+
matches_base_response_prefix() {
37+
local output_file="$1"
38+
python - "$output_file" <<'PY'
39+
import pathlib
40+
import re
41+
import sys
42+
43+
text = pathlib.Path(sys.argv[1]).read_text()
44+
pattern = re.compile(
45+
r"^<\|im_start\|>user Calculate 15% of 80\?<\|im_end\|><\|im_start\|>assistant:\n"
46+
r"(?:<think>\n)+"
47+
r"Okay, so I need to calculate 15% of 80\.",
48+
re.MULTILINE,
49+
)
50+
sys.exit(0 if pattern.match(text) else 1)
51+
PY
52+
}
53+
3654
# Download LoRA adapter.
3755
python -m pip install -q huggingface_hub
3856
HF_ADAPTER_REPO="lucylq/qwen3_06B_lora_math"
@@ -107,7 +125,7 @@ NOW=$(date +"%H:%M:%S")
107125
echo "Finished at ${NOW}"
108126

109127
RESULT=$(cat result_base.txt)
110-
if [[ "${RESULT}" == "${EXPECTED_BASE_PREFIX}"* ]]; then
128+
if matches_base_response_prefix result_base.txt; then
111129
echo "Test 2 (base_forward): Success"
112130
else
113131
echo "Test 2 (base_forward): Failure"

.ci/scripts/test_model_e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ fi
258258
if [ "$AUDIO_URL" != "" ]; then
259259
curl -L $AUDIO_URL -o ${MODEL_DIR}/$AUDIO_FILE
260260
elif [[ "$MODEL_NAME" == *whisper* ]] || [ "$MODEL_NAME" = "voxtral_realtime" ]; then
261-
conda install -y -c conda-forge "ffmpeg<8"
261+
conda install -y -c conda-forge ffmpeg
262262
pip install datasets soundfile
263263
# We pushd'd into EXECUTORCH_ROOT above, so torch_pin is importable here.
264264
TORCHCODEC_PKG=$(python -c "from torch_pin import torchcodec_spec; print(torchcodec_spec())")

0 commit comments

Comments
 (0)