Skip to content

Commit eeaa8a2

Browse files
feat: add LFM2.5-VL-450M quantized model (#1066)
## Description Adds the `LFM2_VL_450M_QUANTIZED` model constant for the new 450M quantized LFM2.5-VL variant. Reuses the existing LFM2.5-VL tokenizer and tokenizer config, and registers the model in `MODEL_REGISTRY`. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [x] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [ ] iOS - [ ] Android ### Testing instructions 1. Import `LFM2_VL_450M_QUANTIZED` from `react-native-executorch`. 2. Pass it to `useLLM` and verify the model downloads and runs inference with image input. ### Screenshots ### Related issues ### Checklist - [x] I have performed a self-review of my code - [ ] 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 Tokenizer and tokenizer config are shared with `LFM2_VL_1_6B_QUANTIZED`.
1 parent dc5664f commit eeaa8a2

File tree

3 files changed

+23
-4
lines changed
  • docs
    • docs/03-hooks/01-natural-language-processing
    • versioned_docs/version-0.8.x/03-hooks/01-natural-language-processing
  • packages/react-native-executorch/src/constants

3 files changed

+23
-4
lines changed

docs/docs/03-hooks/01-natural-language-processing/useLLM.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,5 @@ const handleGenerate = async () => {
564564
| [SmolLM 2](https://huggingface.co/software-mansion/react-native-executorch-smolLm-2) | 135M, 360M, 1.7B || - |
565565
| [LLaMA 3.2](https://huggingface.co/software-mansion/react-native-executorch-llama-3.2) | 1B, 3B || - |
566566
| [LFM2.5](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5) | 350M, 1.2B, 1.6B-VL || - |
567+
| [LFM2.5-VL-450M](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/tree/main/lfm2.5-VL-450M) | 450M || vision |
567568
| [LFM2.5-VL-1.6B](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/tree/main/lfm2.5-VL-1.6B) | 1.6B || vision |

docs/versioned_docs/version-0.8.x/03-hooks/01-natural-language-processing/useLLM.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,5 @@ const handleGenerate = async () => {
564564
| [SmolLM 2](https://huggingface.co/software-mansion/react-native-executorch-smolLm-2) | 135M, 360M, 1.7B || - |
565565
| [LLaMA 3.2](https://huggingface.co/software-mansion/react-native-executorch-llama-3.2) | 1B, 3B || - |
566566
| [LFM2.5](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5) | 350M, 1.2B, 1.6B-VL || - |
567+
| [LFM2.5-VL-450M](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/tree/v0.8.0/lfm2.5-VL-450M) | 450M || vision |
567568
| [LFM2.5-VL-1.6B](https://huggingface.co/software-mansion/react-native-executorch-lfm-2.5/tree/v0.8.0/lfm2.5-VL-1.6B) | 1.6B || vision |

packages/react-native-executorch/src/constants/modelUrls.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,13 @@ export const LFM2_5_350M_QUANTIZED = {
433433

434434
// LFM2.5-VL-1.6B
435435
const LFM2_VL_1_6B_QUANTIZED_MODEL = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-1.6B/quantized/lfm2_5_vl_1_6b_8da4w_xnnpack.pte`;
436-
const LFM2_VL_TOKENIZER = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-1.6B/tokenizer.json`;
437-
const LFM2_VL_TOKENIZER_CONFIG = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-1.6B/tokenizer_config.json`;
436+
const LFM2_VL_1_6B_TOKENIZER = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-1.6B/tokenizer.json`;
437+
const LFM2_VL_1_6B_TOKENIZER_CONFIG = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-1.6B/tokenizer_config.json`;
438+
439+
// LFM2.5-VL-450M
440+
const LFM2_VL_450M_QUANTIZED_MODEL = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-450M/lfm2_5_vl_450m_8da4w_xnnpack.pte`;
441+
const LFM2_VL_450M_TOKENIZER = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-450M/tokenizer.json`;
442+
const LFM2_VL_450M_TOKENIZER_CONFIG = `${URL_PREFIX}-lfm-2.5/${VERSION_TAG}/lfm2.5-VL-450M/tokenizer_config.json`;
438443

439444
/**
440445
* @category Models - VLM
@@ -443,8 +448,19 @@ export const LFM2_VL_1_6B_QUANTIZED = {
443448
modelName: 'lfm2.5-vl-1.6b-quantized',
444449
capabilities: ['vision'],
445450
modelSource: LFM2_VL_1_6B_QUANTIZED_MODEL,
446-
tokenizerSource: LFM2_VL_TOKENIZER,
447-
tokenizerConfigSource: LFM2_VL_TOKENIZER_CONFIG,
451+
tokenizerSource: LFM2_VL_1_6B_TOKENIZER,
452+
tokenizerConfigSource: LFM2_VL_1_6B_TOKENIZER_CONFIG,
453+
} as const;
454+
455+
/**
456+
* @category Models - VLM
457+
*/
458+
export const LFM2_VL_450M_QUANTIZED = {
459+
modelName: 'lfm2.5-vl-450m-quantized',
460+
capabilities: ['vision'],
461+
modelSource: LFM2_VL_450M_QUANTIZED_MODEL,
462+
tokenizerSource: LFM2_VL_450M_TOKENIZER,
463+
tokenizerConfigSource: LFM2_VL_450M_TOKENIZER_CONFIG,
448464
} as const;
449465

450466
// Classification
@@ -1112,6 +1128,7 @@ export const MODEL_REGISTRY = {
11121128
LFM2_5_1_2B_INSTRUCT,
11131129
LFM2_5_1_2B_INSTRUCT_QUANTIZED,
11141130
LFM2_VL_1_6B_QUANTIZED,
1131+
LFM2_VL_450M_QUANTIZED,
11151132
EFFICIENTNET_V2_S,
11161133
EFFICIENTNET_V2_S_QUANTIZED,
11171134
SSDLITE_320_MOBILENET_V3_LARGE,

0 commit comments

Comments
 (0)