https://github.com/mybigday/react-native-qnn-llm
QNN LLM binding for React Native
https://github.com/mybigday/react-native-qnn-llm
ai llm npu npu-llm qnn qualcomm qualcomm-npu react-native
Last synced: about 2 months ago
JSON representation
QNN LLM binding for React Native
- Host: GitHub
- URL: https://github.com/mybigday/react-native-qnn-llm
- Owner: mybigday
- License: mit
- Created: 2025-08-02T11:17:38.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-04-01T08:43:13.000Z (3 months ago)
- Last Synced: 2026-04-24T23:12:28.876Z (2 months ago)
- Topics: ai, llm, npu, npu-llm, qnn, qualcomm, qualcomm-npu, react-native
- Language: C++
- Homepage:
- Size: 1.66 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# react-native-qnn-llm
Qualcomm lib Genie binding for React Native
## Installation
```sh
npm install react-native-qnn-llm
```
### Android Setup
#### Download and setup env
1. Download SDK from [here](https://www.qualcomm.com/developer/software/qualcomm-ai-engine-direct-sdk)
2. Setup env `source path/to/QNN/SDK/bin/envsetup.sh`
#### QNN libs
Add QNN libs dependency into `android/app/build.gradle`
```diff
dependencies {
+ implementation "com.qualcomm.qti:qnn-runtime:latest.integration@aar"
```
Or set `useQnnSdkLib=true` in `android/gradle.properties`
Notes: If you use dependency, the version should match QNN SDK version
#### Proguard
```diff
+ -keep class com.qnnllm.** { *; }
```
## Usage
```js
import { Context, SentenceCode } from 'react-native-qnn-llm';
const context = await Context.create(/* Genie config object */);
// Or load bundled
// const context = await Context.load({ bundle_path: 'path/to/bundle', unpack_dir: 'path/to/store/unpacked', n_thread?: Number })
await context.query('Hello, world!', (result, sentenceCode) => {
console.log(result);
});
await context.save_session('path/to/session-directory');
await context.restore_session('path/to/session-directory');
await context.set_stop_words(['stop_word1', 'stop_word2']);
await context.apply_sampler_config({
/* Genie sampler config */
});
await context.release();
```
## Bundled File
To easier to deploy model, we announced packed file struct.
- Constant entry config path.
- Auto resolve file path.
- Patch config on load.
You can quickly pack your model files use [pack.py](https://github.com/mybigday/node-qnn-llm/blob/main/pack.py).
Usage: `pack.py path/to/config.json`
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT
---
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
---
Built and maintained by BRICKS.