Skip to content

Commit cd0e205

Browse files
authored
refactor: point model URLs at the renamed Hugging Face repos (#1585)
## Description - Point all model URLs at the renamed HF repos (`software-mansion/<Name>-ExecuTorch`); HF redirects the old names, so released versions keep working. - Cache keys hash the previous URL (`renamedRepos.ts`), so already-downloaded models are reused after upgrading. ### 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 - [x] iOS - [x] Android ### Testing instructions - `yarn test` in `packages/react-native-executorch`. - Pre-rename vs post-rename on device (0.8.5, 0.9.3, 0.10.7, main): identical model MD5 and output via old URLs. ### 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 - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes `react-native-executorch-spec` and the deprecated `lfm2.5-VL-1.6B` keep their names.
1 parent 837418b commit cd0e205

18 files changed

Lines changed: 1325 additions & 1145 deletions

File tree

‎.cspell-wordlist.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,5 @@ Picsart
445445
FFHQ
446446
grayscale
447447
Premul
448+
eurollm
449+
doclayout

‎apps/benchmarks/scripts/variant-sizes.json‎

Lines changed: 495 additions & 495 deletions
Large diffs are not rendered by default.

‎docs/docs/02-extensions/computer-vision/11-image-inpainting.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ See [Worklets & Threading](../../03-core-and-advanced/06-worklets-and-threading.
133133

134134
## Available Models
135135

136-
The library provides ready-to-use inpainting models from the [Software Mansion HuggingFace MI-GAN repository](https://huggingface.co/software-mansion/react-native-executorch-migan), available in [`models.inpainting`](../../06-api-reference/variables/models.md#inpainting):
136+
The library provides ready-to-use inpainting models from the [Software Mansion HuggingFace MI-GAN repository](https://huggingface.co/software-mansion/MI-GAN-ExecuTorch), available in [`models.inpainting`](../../06-api-reference/variables/models.md#inpainting):
137137

138138
| Model Family | Variants | Size | Supported Backends | Notes |
139139
| :------------------- | :---------------------------------------------------------------- | :------- | :------------------------------------------- | :--------------------------------------------------------------------------------- |

‎packages/react-native-executorch/__tests__/api/modelRegistry.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
import { models } from '../../src/models';
1414

15-
const BASE_URL = 'https://huggingface.co/software-mansion/react-native-executorch';
15+
const BASE_URL = 'https://huggingface.co/software-mansion';
1616

1717
type Node = Record<string, unknown>;
1818

@@ -128,7 +128,7 @@ describe('models registry — URLs', () => {
128128
});
129129

130130
it.each(urls)('%s is served over https from the software-mansion org', (_path, url) => {
131-
expect(url.startsWith(`${BASE_URL}-`)).toBe(true);
131+
expect(url).toMatch(new RegExp(`^${BASE_URL}/[A-Za-z0-9._-]+-ExecuTorch/`));
132132
});
133133

134134
it.each(urls)('%s pins an explicit revision', (_path, url) => {

‎packages/react-native-executorch/__tests__/api/modelVariants.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ describe('feature map', () => {
455455
const found = new Set<string>();
456456
const walk = (value: unknown): void => {
457457
if (typeof value === 'string') {
458-
const match = value.match(/react-native-executorch-([^/]+)\//);
458+
const match = value.match(/huggingface\.co\/software-mansion\/([^/]+)\//);
459459
if (match) found.add(match[1]!);
460460
} else if (Array.isArray(value)) value.forEach(walk);
461461
else if (isObject(value)) Object.values(value).forEach(walk);
@@ -474,7 +474,7 @@ describe('feature map', () => {
474474
const source = readFileSync(join(__dirname, '../../legacy/src/constants/modelUrls.ts'), 'utf8');
475475
const bySlug = new Map<string, Set<string>>();
476476
for (const [, slug, backend] of source.matchAll(
477-
/\$\{URL_PREFIX\}-([^/`]+)\/[^`]*?\/(xnnpack|coreml|mlx|vulkan)\//g
477+
/\$\{URL_PREFIX\}\/([^/`]+)\/[^`]*?\/(xnnpack|coreml|mlx|vulkan)\//g
478478
)) {
479479
if (!bySlug.has(slug!)) bySlug.set(slug!, new Set());
480480
bySlug.get(slug!)!.add(backend!);

‎packages/react-native-executorch/__tests__/fetcher/download.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,26 @@ describe('download — caching', () => {
137137
expect(fakeNet.countRequests('GET', URL_A)).toBe(requestsAfterFirst);
138138
});
139139

140+
it("reuses a file cached under a renamed repo's previous URL", async () => {
141+
const previous =
142+
'https://huggingface.co/software-mansion/react-native-executorch-lraspp/resolve/v1/model.pte';
143+
const renamed =
144+
'https://huggingface.co/software-mansion/LRASPP-MobileNetV3-Large-ExecuTorch/resolve/v1/model.pte';
145+
fakeNet.serve(previous);
146+
fakeNet.serve(
147+
'https://huggingface.co/software-mansion/react-native-executorch-lraspp/resolve/main/config.json'
148+
);
149+
fakeNet.serve(
150+
'https://huggingface.co/software-mansion/LRASPP-MobileNetV3-Large-ExecuTorch/resolve/main/config.json'
151+
);
152+
153+
const first = await download(previous);
154+
const second = await download(renamed);
155+
156+
expect(second).toBe(first);
157+
expect(fakeNet.countRequests('GET', renamed)).toBe(0);
158+
});
159+
140160
it('reports full progress immediately on a cache hit', async () => {
141161
fakeNet.serve(URL_A);
142162
await download(URL_A);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { RENAMED_HF_REPOS, previousRepoUrl } from '../../src/fetcher/renamedRepos';
2+
3+
const ORG = 'https://huggingface.co/software-mansion';
4+
5+
describe('previousRepoUrl', () => {
6+
it('maps a renamed repo back to its previous name, keeping the path', () => {
7+
expect(previousRepoUrl(`${ORG}/Qwen3-ExecuTorch/resolve/v0.11.0/qwen_3_0_6b/model.pte`)).toBe(
8+
`${ORG}/react-native-executorch-qwen-3/resolve/v0.11.0/qwen_3_0_6b/model.pte`
9+
);
10+
});
11+
12+
it('matches the repo name case-insensitively, as Hugging Face does', () => {
13+
expect(previousRepoUrl(`${ORG}/qwen3-executorch/resolve/v1/m.pte`)).toBe(
14+
`${ORG}/react-native-executorch-qwen-3/resolve/v1/m.pte`
15+
);
16+
});
17+
18+
it('leaves previous-name, unrelated and non-renamed URLs alone', () => {
19+
for (const url of [
20+
`${ORG}/react-native-executorch-qwen-3/resolve/v1/m.pte`,
21+
`${ORG}/react-native-executorch-spec/resolve/main/config.schema.json`,
22+
`${ORG}/Qwen3-ExecuTorch-extra/resolve/v1/m.pte`,
23+
'https://huggingface.co/other-org/Qwen3-ExecuTorch/resolve/v1/m.pte',
24+
'https://example.com/Qwen3-ExecuTorch/m.pte',
25+
]) {
26+
expect(previousRepoUrl(url)).toBe(url);
27+
}
28+
});
29+
30+
it.each(Object.entries(RENAMED_HF_REPOS))(
31+
'%s maps to a react-native-executorch-* name',
32+
(next, previous) => {
33+
expect(next).toMatch(/-ExecuTorch$/);
34+
expect(previous).toMatch(/^react-native-executorch-/);
35+
}
36+
);
37+
38+
it('has no duplicate new names, ignoring case', () => {
39+
const lower = Object.keys(RENAMED_HF_REPOS).map((name) => name.toLowerCase());
40+
expect(new Set(lower).size).toBe(lower.length);
41+
});
42+
});

‎packages/react-native-executorch/legacy/cpp/rnexecutorch/tests/run_tests.sh‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,39 @@ TEST_ASSETS=(
5959
# Models to download (format: "filename|url")
6060
# ============================================================================
6161
MODELS=(
62-
"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"
63-
"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"
64-
"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"
62+
"style_transfer_candy_xnnpack_fp32.pte|https://huggingface.co/software-mansion/Fast-Neural-Style-Transfer-Candy-ExecuTorch/${HF_VERSION_TAG}/xnnpack/style_transfer_candy_xnnpack_fp32.pte"
63+
"efficientnet_v2_s_xnnpack.pte|https://huggingface.co/software-mansion/EfficientNetV2-S-ExecuTorch/${HF_VERSION_TAG}/xnnpack/efficientnet_v2_s_xnnpack_fp32.pte"
64+
"ssdlite320-mobilenetv3-large.pte|https://huggingface.co/software-mansion/SSDlite320-MobileNetV3-Large-ExecuTorch/${HF_VERSION_TAG}/xnnpack/ssdlite320_mobilenet_v3_large_xnnpack_fp32.pte"
6565
"test_image.jpg|https://upload.wikimedia.org/wikipedia/commons/f/f8/Cat_in_tree03.jpg"
66-
"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"
67-
"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"
68-
"tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/${HF_VERSION_TAG}/tokenizer.json"
69-
"fsmn-vad_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-fsmn-vad/${HF_VERSION_TAG}/xnnpack/fsmn_vad_xnnpack_fp32.pte"
70-
"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"
71-
"whisper_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/${HF_VERSION_TAG}/tokenizer.json"
72-
"kokoro_duration_predictor.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/xnnpack/standard/duration_predictor_std.pte"
73-
"kokoro_synthesizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/xnnpack/standard/synthesizer_std.pte"
74-
"kokoro_af_heart.bin|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/voices/af_heart.bin"
75-
"kokoro_us_lexicon.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/lexicon.json"
76-
"kokoro_en_tagger.json|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/tags.json"
77-
"kokoro_us_phonemizer.pte|https://huggingface.co/software-mansion/react-native-executorch-kokoro/${HF_VERSION_TAG}/phonemizer/en-us/phonemizer_en_us.pte"
78-
"smolLm2_135M_8da4w.pte|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/${HF_VERSION_TAG}/135m/xnnpack/smollm2_135m_xnnpack_8da4w.pte"
79-
"smollm_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/${HF_VERSION_TAG}/tokenizer.json"
80-
"deeplabV3_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-deeplab-v3/${HF_VERSION_TAG}/xnnpack/deeplab_v3_resnet50_xnnpack_fp32.pte"
81-
"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"
82-
"xnnpack_craft_quantized.pte|https://huggingface.co/software-mansion/react-native-executorch-detector-craft/${HF_VERSION_TAG}/xnnpack/craft_xnnpack_int8.pte"
83-
"t2i_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-bk-sdm-tiny/${HF_VERSION_TAG}/tokenizer/tokenizer.json"
84-
"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"
85-
"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"
86-
"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"
87-
"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"
88-
"lfm2_vl_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/${HF_VERSION_TAG}/vl_1_6b/tokenizer.json"
89-
"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"
90-
"gemma4_e2b_mm_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-gemma-4-multimodal/${HF_VERSION_TAG}/e2b/xnnpack/gemma_4_e2b_xnnpack_8da4w.pte"
91-
"gemma_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-gemma-4/${HF_VERSION_TAG}/e2b/tokenizer.json"
92-
"yolo26n-seg.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-seg/${HF_VERSION_TAG}/n/xnnpack/yolo26_seg_n_xnnpack_fp32.pte"
66+
"clip-vit-base-patch32-vision_xnnpack.pte|https://huggingface.co/software-mansion/clip-vit-base-patch32-ExecuTorch/${HF_VERSION_TAG}/xnnpack/clip_vit_base_patch32_image_xnnpack_fp32.pte"
67+
"all-MiniLM-L6-v2_xnnpack.pte|https://huggingface.co/software-mansion/all-MiniLM-L6-v2-ExecuTorch/${HF_VERSION_TAG}/xnnpack/all_minilm_l6_v2_xnnpack_fp32.pte"
68+
"tokenizer.json|https://huggingface.co/software-mansion/all-MiniLM-L6-v2-ExecuTorch/${HF_VERSION_TAG}/tokenizer.json"
69+
"fsmn-vad_xnnpack.pte|https://huggingface.co/software-mansion/fsmn-vad-ExecuTorch/${HF_VERSION_TAG}/xnnpack/fsmn_vad_xnnpack_fp32.pte"
70+
"whisper_tiny_en_xnnpack.pte|https://huggingface.co/software-mansion/whisper-tiny.en-ExecuTorch/${HF_VERSION_TAG}/xnnpack/whisper_tiny_en_xnnpack_fp32.pte"
71+
"whisper_tokenizer.json|https://huggingface.co/software-mansion/whisper-tiny.en-ExecuTorch/${HF_VERSION_TAG}/tokenizer.json"
72+
"kokoro_duration_predictor.pte|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/xnnpack/standard/duration_predictor_std.pte"
73+
"kokoro_synthesizer.pte|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/xnnpack/standard/synthesizer_std.pte"
74+
"kokoro_af_heart.bin|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/voices/af_heart.bin"
75+
"kokoro_us_lexicon.json|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/phonemizer/en-us/lexicon.json"
76+
"kokoro_en_tagger.json|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/phonemizer/en-us/tags.json"
77+
"kokoro_us_phonemizer.pte|https://huggingface.co/software-mansion/Kokoro-82M-ExecuTorch/${HF_VERSION_TAG}/phonemizer/en-us/phonemizer_en_us.pte"
78+
"smolLm2_135M_8da4w.pte|https://huggingface.co/software-mansion/SmolLM2-ExecuTorch/${HF_VERSION_TAG}/135m/xnnpack/smollm2_135m_xnnpack_8da4w.pte"
79+
"smollm_tokenizer.json|https://huggingface.co/software-mansion/SmolLM2-ExecuTorch/${HF_VERSION_TAG}/tokenizer.json"
80+
"deeplabV3_xnnpack_fp32.pte|https://huggingface.co/software-mansion/DeepLabV3-ExecuTorch/${HF_VERSION_TAG}/xnnpack/deeplab_v3_resnet50_xnnpack_fp32.pte"
81+
"xnnpack_crnn_english.pte|https://huggingface.co/software-mansion/EasyOCR-CRNN-ExecuTorch/${HF_VERSION_TAG}/english/xnnpack/crnn_english_xnnpack_fp32.pte"
82+
"xnnpack_craft_quantized.pte|https://huggingface.co/software-mansion/CRAFT-ExecuTorch/${HF_VERSION_TAG}/xnnpack/craft_xnnpack_int8.pte"
83+
"t2i_tokenizer.json|https://huggingface.co/software-mansion/bk-sdm-tiny-ExecuTorch/${HF_VERSION_TAG}/tokenizer/tokenizer.json"
84+
"t2i_encoder.pte|https://huggingface.co/software-mansion/bk-sdm-tiny-ExecuTorch/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_text_encoder_xnnpack_fp32.pte"
85+
"t2i_unet.pte|https://huggingface.co/software-mansion/bk-sdm-tiny-ExecuTorch/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_unet_256_xnnpack_fp32.pte"
86+
"t2i_decoder.pte|https://huggingface.co/software-mansion/bk-sdm-tiny-ExecuTorch/${HF_VERSION_TAG}/xnnpack/bk_sdm_tiny_vae_256_xnnpack_fp32.pte"
87+
"lfm2_5_vl_quantized_xnnpack_v2.pte|https://huggingface.co/software-mansion/LFM2.5-ExecuTorch/${HF_VERSION_TAG}/vl_1_6b/xnnpack/lfm_2_5_vl_1_6b_xnnpack_8da4w.pte"
88+
"lfm2_vl_tokenizer.json|https://huggingface.co/software-mansion/LFM2.5-ExecuTorch/${HF_VERSION_TAG}/vl_1_6b/tokenizer.json"
89+
"lfm2_vl_tokenizer_config.json|https://huggingface.co/software-mansion/LFM2.5-ExecuTorch/${HF_VERSION_TAG}/vl_1_6b/tokenizer_config.json"
90+
"gemma4_e2b_mm_xnnpack.pte|https://huggingface.co/software-mansion/gemma-4-E2B-it-ExecuTorch/${HF_VERSION_TAG}/e2b/xnnpack/gemma_4_e2b_xnnpack_8da4w.pte"
91+
"gemma_tokenizer.json|https://huggingface.co/software-mansion/gemma-4-E2B-it-text-ExecuTorch/${HF_VERSION_TAG}/e2b/tokenizer.json"
92+
"yolo26n-seg.pte|https://huggingface.co/software-mansion/YOLO26-seg-ExecuTorch/${HF_VERSION_TAG}/n/xnnpack/yolo26_seg_n_xnnpack_fp32.pte"
9393
"segmentation_image.jpg|https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Collage_audi.jpg/1280px-Collage_audi.jpg"
94-
"yolo26n-pose.pte|https://huggingface.co/software-mansion/react-native-executorch-yolo26-pose/${HF_VERSION_TAG}/xnnpack/yolo26_pose_n_xnnpack_fp32.pte"
94+
"yolo26n-pose.pte|https://huggingface.co/software-mansion/YOLO26-pose-ExecuTorch/${HF_VERSION_TAG}/xnnpack/yolo26_pose_n_xnnpack_fp32.pte"
9595
)
9696

9797
# ============================================================================

0 commit comments

Comments
 (0)