Skip to content

Commit 2b1dbe3

Browse files
committed
gemma4 hg updaloed
1 parent 3a2bf05 commit 2b1dbe3

7 files changed

Lines changed: 19 additions & 16 deletions

File tree

‎packages/react-native-executorch/common/runner/constants.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inline constexpr auto kImagePlaceholderId = "image_placeholder_id";
2626
// Multimodal method name conventions
2727
inline constexpr auto kVisionEncoderMethod = "vision_encoder";
2828
inline constexpr auto kAudioEncoderMethod = "audio_encoder";
29-
inline constexpr auto kTokenEmbeddingMethod = "token_embedding";
29+
inline constexpr auto kTokenEmbeddingMethod = "text_encoder";
3030
inline constexpr auto kTextModelMethod = "text_decoder";
3131
// Absolute ceiling on prefill length (in tokens) and the fallback value used
3232
// when a PTE doesn't bake `get_max_seq_len`. 2048 matches Gemma4 iter201's

‎packages/react-native-executorch/common/runner/encoders/audio_encoder.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Result<EValue> AudioEncoder::encode(const MultimodalInput &input) {
9898
std::memcpy(padded_wav_.data(), wav.samples.data(),
9999
static_cast<size_t>(n_valid) * sizeof(float));
100100

101-
num_blocks_scalar_ = k_blocks;
101+
num_blocks_scalar_ = n_valid;
102102

103103
auto wav_tensor = ::executorch::extension::from_blob(
104104
padded_wav_.data(), {1, static_cast<SizesType>(n_padded)},

‎packages/react-native-executorch/src/constants/modelRegistry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ export const models = {
488488
// pick a model by capability ("LLM") rather than by modality.
489489
lfm2_5_vl_1_6b: base(M.LFM2_5_VL_1_6B_QUANTIZED),
490490
lfm2_5_vl_450m: base(M.LFM2_5_VL_450M_QUANTIZED),
491-
gemma4_e2b: base(M.GEMMA4_E2B_QUANTIZED)
491+
gemma4_e2b: base(M.GEMMA4_E2B),
492492
},
493493
classification: {
494494
efficientnet_v2_s: variant(EFFICIENTNET_V2_S_VARIANTS),

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ export const LLAMA3_2_3B_SPINQUANT = {
5656
*/
5757
export const LLAMA3_2_1B = {
5858
modelName: 'llama-3.2-1b',
59-
modelSource:
60-
'http://localhost:9001/Llama3.2-1B-Instruct_vulkan_8da4w_g64_c2048.pte',
61-
tokenizerSource: 'http://localhost:9001/gemma4_e2b/llama_tokenizer.json',
62-
tokenizerConfigSource:
63-
'http://localhost:9001/gemma4_e2b/llama_tokenizer_config.json',
59+
modelSource: LLAMA3_2_1B_MODEL,
60+
tokenizerSource: LLAMA3_2_TOKENIZER,
61+
tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG,
6462
} as const;
6563

6664
/**
@@ -127,17 +125,21 @@ export const QWEN3_0_6B_QUANTIZED = {
127125
generationConfig: QWEN3_GENERATION_CONFIG,
128126
} as const;
129127

128+
// GEMMA 4
129+
const GEMMA4_E2B_XNNPACK = `${URL_PREFIX}-gemma-4/${VERSION_TAG}/e2b/xnnpack/gemma_4_e2b_xnnpack_8da4w.pte`;
130+
const GEMMA4_E2B_VULKAN = `${URL_PREFIX}-gemma-4/${VERSION_TAG}/e2b/vulkan/gemma_4_e2b_vulkan_8da4w.pte`;
131+
const GEMMA4_TOKENIZER = `${URL_PREFIX}-gemma-4/${VERSION_TAG}/e2b/xnnpack/tokenizer.json`;
132+
const GEMMA4_TOKENIZER_CONFIG = `${URL_PREFIX}-gemma-4/${VERSION_TAG}/e2b/xnnpack/tokenizer_config.json`;
133+
130134
/**
131135
* @category Models - VLM
132136
*/
133-
export const GEMMA4_E2B_QUANTIZED = {
134-
modelName: 'gemma4-e2b-quantized',
135-
modelSource:
136-
// 'http://localhost:9001/ptes/iter206_xnnpack_audio_rsqrt_baked_mask_relshift_idx_prefill2048.pte',
137-
'http://localhost:9001/experiments/outputs/exp115_mm_s4048_levers.pte',
138-
tokenizerSource: 'http://localhost:9001/gemma4_e2b/tokenizer.json',
139-
tokenizerConfigSource:
140-
'http://localhost:9001/gemma4_e2b/gemma4_tokenizer_config.json',
137+
export const GEMMA4_E2B = {
138+
modelName: 'gemma4-e2b-vulkan',
139+
modelSource: GEMMA4_E2B_VULKAN,
140+
// 'http://localhost:9001/experiments/outputs/exp115_mm_s4048_levers.pte',
141+
tokenizerSource: GEMMA4_TOKENIZER,
142+
tokenizerConfigSource: GEMMA4_TOKENIZER_CONFIG,
141143
capabilities: ['vision', 'audio'],
142144
} as const;
143145

‎packages/react-native-executorch/src/controllers/LLMController.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ export class LLMController {
319319
this.isGeneratingCallback(true);
320320
this.nativeModule.reset();
321321
let response: string;
322+
console.log(input);
322323
if (hasImages || hasAudio) {
323324
response = await this.nativeModule.generateMultimodal(
324325
input,
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)