Skip to content

Commit 6ebf307

Browse files
committed
feat: add PowerServe support
1 parent 4ee94c6 commit 6ebf307

38 files changed

+1481
-88
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "app/src/main/cpp/PowerServe"]
2+
path = app/src/main/cpp/PowerServe
3+
url = https://github.com/powerserve-project/PowerServe.git

.idea/codeStyles/Project.xml

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 80 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,81 @@
22

33
<img width="200" height="200" style="display: block;" src="./images/logo.png">
44

5-
# GPT Mobile
6-
7-
### Chat Assistant for Android that supports chatting with multiple models at once.
8-
9-
<p>
10-
<a href="https://mailchi.mp/kotlinweekly/kotlin-weekly-431"><img alt="Kotlin Weekly" src="https://img.shields.io/badge/Kotlin%20Weekly-%23431-blue"/></a>
11-
<img alt="Android" src="https://img.shields.io/badge/Platform-Android-green.svg"/>
12-
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/Taewan-P/gpt_mobile/release-build.yml">
13-
<a href="https://hosted.weblate.org/engage/gptmobile/"><img src="https://hosted.weblate.org/widget/gptmobile/gptmobile/svg-badge.svg" alt="Translation status" /></a>
14-
<a href="https://github.com/Taewan-P/gpt_mobile/releases/"><img alt="GitHub Releases Total Downloads" src="https://img.shields.io/github/downloads/Taewan-P/gpt_mobile/total?label=Downloads&logo=github"/></a>
15-
<a href="https://github.com/Taewan-P/gpt_mobile/releases/latest/"><img alt="GitHub Releases (latest by date)" src="https://img.shields.io/github/v/release/Taewan-P/gpt_mobile?color=black&label=Stable&logo=github"/></a>
16-
</p>
17-
18-
19-
</div>
20-
21-
22-
## Screenshots
23-
24-
<div align="center">
25-
26-
<img style="display: block;" src="./images/screenshots.webp">
27-
285
</div>
296

30-
## Demos
31-
32-
33-
| <video src="https://github.com/Taewan-P/gpt_mobile/assets/27392567/96229e6d-6795-48b4-a915-aca915bd2527"/> | <video src="https://github.com/Taewan-P/gpt_mobile/assets/27392567/1cc13413-7320-4f6f-ace9-de76de58adcc"/> | <video src="https://github.com/Taewan-P/gpt_mobile/assets/27392567/546e2694-953d-4d67-937f-a29fba81046f"/> |
34-
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
35-
7+
# GPT Mobile + PowerServe
8+
9+
This subject is forked from open-source project [GPT Mobile](https://github.com/Taewan-P/gpt_mobile). The PowerServe is integrated into the app as one of the inference backend.
10+
11+
## Build
12+
13+
### Initialization
14+
This project is integrated with PowerServe as a submodule and build it as a JNI static library.
15+
Before building, please execute the following command(s) to **init submodules**:
16+
```shell
17+
git submodule update --init --recursive
18+
```
19+
20+
### Prepare Libraries
21+
This step is for QNN support. If you are to compile a executable for only-CPU platform, please skip this step.
22+
23+
Then copy QNN library into the directory `app/src/main/jniLibs/<arch>`. For latest phone "One plus 13" with architecture *arm64-v8a*, libraries should be copied into `app/src/main/jniLibs/arm64-v8a`, just like:
24+
```
25+
--- app
26+
--- src
27+
--- main
28+
--- jniLibs
29+
--- arm64-v8a
30+
--- libQnnHtp.so
31+
--- libQnnHtpV79.so
32+
--- libQnnHtpV79Skel.so
33+
--- libQnnHtpV79Stub.so
34+
--- libQnnSystem.so
35+
```
36+
where the 64-bit QNN libraries("libQnnHtp.so", "libQnnSystem.so", "libQnnHtpV79Stub.so") come from **"\$QNN_SDK_ROOT/lib/aarch64-android"**
37+
while the 32-bit QNN library("libQnnHtpV79.so", "libQnnHtpV79Skel.so") comes from **"\$QNN_SDK_ROOT/lib/hexagon-v79/unsigned"**
38+
39+
If you are using 8Gen3 or other qualcomm processors, the libraries placement is similar while the version should change to the proper one according to the [Documentation](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/overview.html#supported-snapdragon-devices):
40+
41+
| Processor | Hexagon Arch |
42+
|------------|--------------|
43+
| 8Gen Elite | V79 |
44+
| 8Gen 3 | V75 |
45+
46+
47+
### Compile and Execute
48+
49+
> Do set the environment variable **QNN_SDK_ROOT** as the path to QNN SDK before compile this project when compiling an executable for NPU.
50+
>
51+
> Do change the
52+
53+
Open this project with Android Studio, download necessary dependencies automatically and build up the app.
54+
55+
## Usage
56+
57+
> Note: For reading and downloading models, the program acquire **MANAGE_EXTERNAL_STORAGE** privilege. PowerServe backend does not acquire network connection (except for model downloading), it will not collect any user data as well.
58+
59+
The program will search the model directory(/storage/emulated/0/Download/powerserve) in external storage for models.
60+
You can just select expected model for automatic downloading or download it from [huggingface](https://huggingface.co/PowerServe) to the model directory(/storage/emulated/0/Download/powerserve) directly.
61+
62+
Most of the time, you can find the Download directory(/storage/emulated/0/Download) in the file manager directly. For those who want to download and try a model manually,
63+
just create the directory `powerserve` under the Download directory and download models into it. The construction should be
64+
```shell
65+
└── Download
66+
└── powerserve
67+
├── SmallThinker-3B-PowerServe-QNN29-8Gen4
68+
│ ├── model.json
69+
│ ├── vocab.gguf
70+
│ ├── ggml
71+
│ │ └── weights.gguf
72+
│ └── qnn
73+
│ ├── lmhead.bin
74+
│ ├── kv
75+
│ │ └── ...
76+
│ └── ...
77+
└──SmallThinker-0.5B-PowerServe-QNN29-8Gen4
78+
└── ...
79+
```
3680

3781
## Features
3882

@@ -44,6 +88,7 @@
4488
- Google Gemini
4589
- Groq
4690
- Ollama
91+
- PowerServe
4792
- Can customize temperature, top p (Nucleus sampling), and system prompt
4893
- Custom API URLs, Custom Models are also supported
4994
- Local chat history
@@ -54,45 +99,14 @@
5499
- Per app language setting for Android 13+
55100
- 100% Kotlin, Jetpack Compose, Single Activity, [Modern App Architecture](https://developer.android.com/topic/architecture#modern-app-architecture) in Android developers documentation
56101

57-
58-
## To be supported
59-
60-
- More platforms
61-
- Image, file support for multimodal models
62-
63-
If you have any feature requests, please open an issue.
64-
65-
66-
## Downloads
67-
68-
You can download the app from the following sites:
69-
70-
[<img height="80" alt="Get it on F-Droid" src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"/>](https://f-droid.org/packages/dev.chungjungsoo.gptmobile)
71-
[<img height="80" alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png'/>](https://play.google.com/store/apps/details?id=dev.chungjungsoo.gptmobile&utm_source=github&utm_campaign=gh-readme)
72-
[<img height="80" alt='Get it on GitHub' src='https://raw.githubusercontent.com/Kunzisoft/Github-badge/main/get-it-on-github.png'/>](https://github.com/Taewan-P/gpt_mobile/releases)
73-
74-
Cross platform updates are supported. However, GitHub Releases will be the fastest track among the platforms since there is no verification/auditing process. (Probably 1 week difference?)
75-
76-
77-
78-
## Contributions
79-
80-
Contributions are welcome! The contribution guideline is not yet available, but I will be happy to review it! 💯
81-
82-
For translations, we are using [Hosted Weblate](https://hosted.weblate.org/engage/gptmobile/). If you want your language supported, help us translate the app!
83-
84-
<a href="https://hosted.weblate.org/engage/gptmobile/">
85-
<img src="https://hosted.weblate.org/widget/gptmobile/gptmobile/multi-auto.svg" alt="Translation status" />
86-
</a>
87-
88-
89-
## Star History
90-
91-
[![Star History Chart](https://api.star-history.com/svg?repos=Taewan-P/gpt_mobile&type=Timeline)](https://star-history.com/#Taewan-P/gpt_mobile&Timeline)
92-
93-
94102
## License
95103

96104
See [LICENSE](./LICENSE) for details.
97105

98106
[F-Droid Icon License](https://gitlab.com/fdroid/artwork/-/blob/master/fdroid-logo-2015/README.md)
107+
108+
## Known Issue
109+
110+
1. Because this app use PowerServe as local backend, which is in test mode currently, if some operation causes crash of the backend, the App crash as well.
111+
2. PowerServe haven't implemented ring-round KVCache. When running multi-round chat or use o1-like model, it may incurs KVCache overflow.
112+
3. Touching multiple model may fails to create QNN shared buffer if setting -DPOWERSERVE_SERVER_MULTIMODEL=ON in the build.gradle.kts.

0 commit comments

Comments
 (0)