Downloads · 30 days
8
24% of all-time downloads
shahxeebhassan/wherezat-qwen15-pte-working-tested
wherezat-qwen15-pte-working-tested is a machine learning model from shahxeebhassan. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
======================================================================== MOBILE TEAM HANDOFF ========================================================================
Downloads · 30 days
8
24% of all-time downloads
All-time downloads
34
Public
Repo size
1.1 GB
Likes
0
Public
Click a slice to open those files.
.pte1.1 GB · 99%
From the Hugging Face model README
⚠ STEP 0 — Check the mobile team's installed react-native-executorch version in Where_Zat/package.json. The PTE itself loads on any v0.6.0+ (which all bundle ExecuTorch Runtime v1.0.0+). The JS integration code is what varies. Pick ONE of the three options below.
Verified from npm registry: latest = 0.8.4, legacy = 0.7.3.
───────────────────────────────────────────────────────────────────────── OPTION A — react-native-executorch v0.8.x (current latest) ─────────────────────────────────────────────────────────────────────────
⚠ v0.8.0 introduced TWO breaking changes vs v0.7.x:
initExecutorch() MUST be called once at app startupcontextWindowLength was renamed/replaced by contextStrategy// ── App.tsx (or wherever your provider tree is rooted) ──────────────── import { initExecutorch } from 'react-native-executorch';
// Pick ONE adapter based on whether the app uses Expo: import { ExpoResourceFetcher } from 'react-native-executorch-expo-resource-fetcher'; // --- OR --- // import { BareResourceFetcher } from 'react-native-executorch-bare-resource-fetcher';
initExecutorch({ resourceFetcher: ExpoResourceFetcher }); // call ONCE at app entry
// ── In your component ───────────────────────────────────────────────── import { useLLM, getStructuredOutputPrompt, fixAndValidateStructuredOutput, MessageCountContextStrategy, } from 'react-native-executorch';
const wherezatSchema = { type: 'object', properties: { intent: { type: 'string', enum: [ 'store_item','find_item','update_item','delete_item','list_items', 'greeting','thanks','goodbye','help','unknown' ]}, item: { type: ['string', 'null'] }, location: { type: ['string', 'null'] }, message: { type: 'string' }, confirm_item: { type: 'boolean' }, accessibility: { type: ['string', 'null'], enum: ['private', 'public', null] }, }, required: ['intent', 'message'], };
const llm = useLLM({ modelSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/wherezat_qwen15.pte', tokenizerSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer.json', tokenizerConfigSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer_config.json', });
// Configure once. Append the schema instructions to the system prompt so // the model is constrained to emit valid JSON. useEffect(() => { if (!llm.isReady) return; llm.configure({ chatConfig: { systemPrompt: SYSTEM_PROMPT + getStructuredOutputPrompt(wherezatSchema), contextStrategy: new MessageCountContextStrategy(6), // keep last 6 msgs }, }); }, [llm.isReady]);
───────────────────────────────────────────────────────────────────────── OPTION B — react-native-executorch v0.6.x – v0.7.x (no initExecutorch) ─────────────────────────────────────────────────────────────────────────
const llm = useLLM({ modelSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/wherezat_qwen15.pte', tokenizerSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer.json', tokenizerConfigSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer_config.json', });
───────────────────────────────────────────────────────────────────────── OPTION C — react-native-executorch v0.4.x – v0.5.x (older flat API) ─────────────────────────────────────────────────────────────────────────
const llm = useLLM({ modelSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/wherezat_qwen15.pte', tokenizerSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer.json', tokenizerConfigSource: 'https://huggingface.co/shahxeebhassan/wherezat-qwen15-pte-working-tested/resolve/main/tokenizer_config.json', });
───────────────────────────────────────────────────────────────────────── INFERENCE — generate() takes a Message[] array DIRECTLY (not wrapped) ─────────────────────────────────────────────────────────────────────────
// ✅ Correct — what the v0.8.x docs show const response = await llm.generate([ { role: 'system', content: SYSTEM_PROMPT }, // see below — verbatim { role: 'user', content: userInput }, ]);
// ⚠ Do NOT call generate({ messages: [...] }) — that signature does NOT exist
───────────────────────────────────────────────────────────────────────── PARSING THE RESPONSE — use the structured-output helper, not bare JSON.parse ─────────────────────────────────────────────────────────────────────────
// On v0.8+ — robust against minor formatting glitches: const parsed = fixAndValidateStructuredOutput(response, wherezatSchema); // → { intent, item, location, message, confirm_item, accessibility }
// On older versions (no helper available): const parsed = JSON.parse(response); // wrap in try/catch
Classify the message for an item locator app. Output ONLY a JSON object. {"intent":"INTENT","item":"ITEM","location":"LOC","message":"MSG","confirm_item":BOOL,"accessibility":ACC}
Intents:
Rules:
confirm_item rules for move/delete with "it/this/that":