Skip to content

Commit 578f983

Browse files
authored
test(native): unify model URLs on v0.9.0 + fix ssdlite shape assertion (#1185)
## Description The native test runner downloaded model artifacts from a mix of `main`, `v0.6.0`, `v0.7.0`, `v0.8.0`, and `v0.9.0` HuggingFace paths, none of which lined up with what `src/constants/modelUrls.ts` actually ships on v0.9.0. This PR points every `MODELS` entry in `run_tests.sh` at its canonical v0.9.0 path (verified with HEAD checks), keeping the destination filenames identical so the integration `.cpp` constants don't need to move. The v0.9.0 SSDLite is exported without a leading batch dim, so `ObjectDetectionInheritedTests.GetInputShapeWorks` now asserts rank-3 `(C, H, W)` instead of rank-4 `(1, C, H, W)`. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [x] Other (chores, tests, code style improvements etc.) ### Tested on - [ ] iOS - [x] Android ### Testing instructions ```bash cd packages/react-native-executorch/common/rnexecutorch/tests bash ./run_tests.sh --refresh-models ``` `--refresh-models` is required on first run since every URL changed; cached files from older versions are stale. All 23 test suites pass on a physical Android device. ### Screenshots ### Related issues ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes
1 parent 72359c0 commit 578f983

2 files changed

Lines changed: 39 additions & 32 deletions

File tree

packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ TEST(ObjectDetectionInheritedTests, GetInputShapeWorks) {
207207
ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
208208
nullptr);
209209
auto shape = model.getInputShape("forward", 0);
210-
EXPECT_EQ(shape.size(), 4);
211-
EXPECT_EQ(shape[0], 1);
212-
EXPECT_EQ(shape[1], 3);
210+
// v0.9.0 ssdlite is exported without a leading batch dim, so the signature
211+
// is (C, H, W) rather than the (1, C, H, W) used by sibling vision models.
212+
EXPECT_EQ(shape.size(), 3);
213+
EXPECT_EQ(shape[0], 3);
214+
EXPECT_EQ(shape[1], 320);
213215
}
214216

215217
TEST(ObjectDetectionInheritedTests, GetAllInputShapesWorks) {

packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ ANDROID_LIBS_DIR="$PACKAGE_ROOT/third-party/android/libs"
1111
DEVICE_TEST_DIR="/data/local/tmp/rnexecutorch_tests"
1212
MODELS_DIR="$SCRIPT_DIR/integration/assets/models"
1313

14+
# Keep in sync with `LIB_VERSION` in src/constants/versions.ts so the runner
15+
# pulls the same artifacts that the JS API ships at runtime.
16+
LIB_VERSION="0.9.0"
17+
HF_VERSION_TAG="resolve/v${LIB_VERSION}"
18+
1419
# ============================================================================
1520
# Test executables
1621
# ============================================================================
@@ -53,37 +58,37 @@ TEST_ASSETS=(
5358
# Models to download (format: "filename|url")
5459
# ============================================================================
5560
MODELS=(
56-
"style_transfer_candy_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/main/xnnpack/style_transfer_candy_xnnpack_fp32.pte"
57-
"efficientnet_v2_s_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s/resolve/v0.6.0/xnnpack/efficientnet_v2_s_xnnpack.pte"
58-
"ssdlite320-mobilenetv3-large.pte|https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/resolve/v0.6.0/ssdlite320-mobilenetv3-large.pte"
61+
"style_transfer_candy_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/${HF_VERSION_TAG}/xnnpack/style_transfer_candy_xnnpack_fp32.pte"
62+
"efficientnet_v2_s_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s/${HF_VERSION_TAG}/xnnpack/efficientnet_v2_s_xnnpack_fp32.pte"
63+
"ssdlite320-mobilenetv3-large.pte|https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/${HF_VERSION_TAG}/xnnpack/ssdlite320_mobilenet_v3_large_xnnpack_fp32.pte"
5964
"test_image.jpg|https://upload.wikimedia.org/wikipedia/commons/f/f8/Cat_in_tree03.jpg"
60-
"clip-vit-base-patch32-vision_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-clip-vit-base-patch32/resolve/v0.6.0/clip-vit-base-patch32-vision_xnnpack.pte"
61-
"all-MiniLM-L6-v2_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/resolve/v0.6.0/all-MiniLM-L6-v2_xnnpack.pte"
62-
"tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/resolve/v0.6.0/tokenizer.json"
63-
"fsmn-vad_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-fsmn-vad/resolve/main/xnnpack/fsmn_vad_xnnpack_fp32.pte"
64-
"whisper_tiny_en_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/v0.8.0/xnnpack/whisper_tiny_en_xnnpack.pte"
65-
"whisper_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/v0.8.0/tokenizer.json"
66-
"kokoro_duration_predictor.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/xnnpack/standard/duration_predictor_std.pte"
67-
"kokoro_synthesizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/xnnpack/standard/synthesizer_std.pte"
68-
"kokoro_af_heart.bin|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/voices/af_heart.bin"
69-
"kokoro_us_lexicon.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/phonemizer/en-us/lexicon.json"
70-
"kokoro_en_tagger.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/phonemizer/en-us/tags.json"
71-
"kokoro_us_phonemizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/resolve/v0.9.0/phonemizer/en-us/phonemizer_en_us.pte"
72-
"smolLm2_135M_8da4w.pte|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/resolve/v0.6.0/smolLm-2-135M/quantized/smolLm2_135M_8da4w.pte"
73-
"smollm_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/resolve/v0.6.0/tokenizer.json"
74-
"deeplabV3_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-deeplab-v3/resolve/v0.6.0/xnnpack/deeplabV3_xnnpack_fp32.pte"
75-
"xnnpack_crnn_english.pte|https://huggingface.co/software-mansion/react-native-executorch-recognizer-crnn.en/resolve/v0.7.0/xnnpack/english/xnnpack_crnn_english.pte"
76-
"xnnpack_craft_quantized.pte|https://huggingface.co/software-mansion/react-native-executorch-detector-craft/resolve/v0.7.0/xnnpack/xnnpack_craft.pte"
77-
"t2i_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/resolve/v0.6.0/tokenizer/tokenizer.json"
78-
"t2i_encoder.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/resolve/v0.6.0/text_encoder/model.pte"
79-
"t2i_unet.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/resolve/v0.6.0/unet/model.256.pte"
80-
"t2i_decoder.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/resolve/v0.6.0/vae/model.256.pte"
81-
"lfm2_5_vl_quantized_xnnpack_v2.pte|https://huggingface.co/software-mansion/react-native-executorch-lfm2.5-VL-1.6B/resolve/main/quantized/lfm2_5_vl_1_6b_8da4w_xnnpack.pte"
82-
"lfm2_vl_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-lfm2.5-VL-1.6B/resolve/main/tokenizer.json"
83-
"lfm2_vl_tokenizer_config.json|https://huggingface.co/software-mansion/react-native-executorch-lfm2.5-VL-1.6B/resolve/main/tokenizer_config.json"
84-
"yolo26n-seg.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-seg/resolve/v0.8.0/yolo26n-seg/xnnpack/yolo26n-seg.pte"
65+
"clip-vit-base-patch32-vision_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-clip-vit-base-patch32/${HF_VERSION_TAG}/xnnpack/clip_vit_base_patch32_image_xnnpack_fp32.pte"
66+
"all-MiniLM-L6-v2_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/${HF_VERSION_TAG}/xnnpack/all_minilm_l6_v2_xnnpack_fp32.pte"
67+
"tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/${HF_VERSION_TAG}/tokenizer.json"
68+
"fsmn-vad_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-fsmn-vad/${HF_VERSION_TAG}/xnnpack/fsmn_vad_xnnpack_fp32.pte"
69+
"whisper_tiny_en_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/${HF_VERSION_TAG}/xnnpack/whisper_tiny_en_xnnpack_fp32.pte"
70+
"whisper_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/${HF_VERSION_TAG}/tokenizer.json"
71+
"kokoro_duration_predictor.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/xnnpack/standard/duration_predictor_std.pte"
72+
"kokoro_synthesizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/xnnpack/standard/synthesizer_std.pte"
73+
"kokoro_af_heart.bin|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/voices/af_heart.bin"
74+
"kokoro_us_lexicon.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/lexicon.json"
75+
"kokoro_en_tagger.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/tags.json"
76+
"kokoro_us_phonemizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/phonemizer_en_us.pte"
77+
"smolLm2_135M_8da4w.pte|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/${HF_VERSION_TAG}/135m/xnnpack/smollm2_135m_xnnpack_8da4w.pte"
78+
"smollm_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/${HF_VERSION_TAG}/tokenizer.json"
79+
"deeplabV3_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-deeplab-v3/${HF_VERSION_TAG}/xnnpack/deeplab_v3_resnet50_xnnpack_fp32.pte"
80+
"xnnpack_crnn_english.pte|https://huggingface.co/software-mansion/react-native-executorch-recognizer-crnn.en/${HF_VERSION_TAG}/english/xnnpack/crnn_english_xnnpack_fp32.pte"
81+
"xnnpack_craft_quantized.pte|https://huggingface.co/software-mansion/react-native-executorch-detector-craft/${HF_VERSION_TAG}/xnnpack/craft_xnnpack_int8.pte"
82+
"t2i_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/${HF_VERSION_TAG}/tokenizer/tokenizer.json"
83+
"t2i_encoder.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_text_encoder_xnnpack_fp32.pte"
84+
"t2i_unet.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_unet_256_xnnpack_fp32.pte"
85+
"t2i_decoder.pte|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_vae_256_xnnpack_fp32.pte"
86+
"lfm2_5_vl_quantized_xnnpack_v2.pte|https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/${HF_VERSION_TAG}/vl_1_6b/xnnpack/lfm_2_5_vl_1_6b_xnnpack_8da4w.pte"
87+
"lfm2_vl_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/${HF_VERSION_TAG}/vl_1_6b/tokenizer.json"
88+
"lfm2_vl_tokenizer_config.json|https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/${HF_VERSION_TAG}/vl_1_6b/tokenizer_config.json"
89+
"yolo26n-seg.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-seg/${HF_VERSION_TAG}/n/xnnpack/yolo26_seg_n_xnnpack_fp32.pte"
8590
"segmentation_image.jpg|https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Collage_audi.jpg/1280px-Collage_audi.jpg"
86-
"yolo26n-pose.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-pose/resolve/v0.9.0/xnnpack/yolo26_pose_n_xnnpack_fp32.pte"
91+
"yolo26n-pose.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-pose/${HF_VERSION_TAG}/xnnpack/yolo26_pose_n_xnnpack_fp32.pte"
8792
)
8893

8994
# ============================================================================

0 commit comments

Comments
 (0)