Skip to content

Commit

Permalink
feat: sync llama.rn -> llama.cpp (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ghorbani authored Nov 29, 2024
1 parent b2d6386 commit d0d5ee2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PODS:
- hermes-engine/Pre-built (= 0.73.7)
- hermes-engine/Pre-built (0.73.7)
- libevent (2.1.12)
- llama-rn (0.3.12):
- llama-rn (0.4.3-1):
- React-Core
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2022.05.16.00):
Expand Down Expand Up @@ -1464,7 +1464,7 @@ SPEC CHECKSUMS:
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 39589e9c297d024e90fe68f6830ff86c4e01498a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
llama-rn: 79f49fb25fc92ecbda076e7cb7b56fb7db6e5ab9
llama-rn: b69b2a7416b025c262a95a1cb0e12ad8703c55fc
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: 77f73950d15b8c1a2b48ba5b79020c3003d1c9b5
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@flyerhq/react-native-link-preview": "^1.6.0",
"@gorhom/bottom-sheet": "^5.0.5",
"@pocketpalai/llama.rn": "^0.3.12",
"@pocketpalai/llama.rn": "0.4.3-1",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-clipboard/clipboard": "^1.14.0",
"@react-native-community/blur": "^4.4.1",
Expand Down
18 changes: 12 additions & 6 deletions src/store/ModelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,18 @@ class ModelStore {
this.loadingModel = model;
});
try {
const ctx = await initLlama({
model: filePath,
use_mlock: true,
n_ctx: this.n_context,
n_gpu_layers: this.useMetal ? this.n_gpu_layers : 0, // Set as needed, 0 for no GPU // TODO ggml-metal.metal
});
const ctx = await initLlama(
{
model: filePath,
use_mlock: true,
n_ctx: this.n_context,
n_gpu_layers: this.useMetal ? this.n_gpu_layers : 0, // Set as needed, 0 for no GPU // TODO ggml-metal.metal
use_progress_callback: true,
},
(_progress: number) => {
//console.log('progress: ', _progress);
},
);

// Get stop token from the model and add to the list of stop tokens.
const eos_token_id = Number(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1738,10 +1738,10 @@
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==

"@pocketpalai/llama.rn@^0.3.12":
version "0.3.12"
resolved "https://registry.yarnpkg.com/@pocketpalai/llama.rn/-/llama.rn-0.3.12.tgz#378bdff95b87a49eccaac2bef368c5ed4c1511e8"
integrity sha512-1nEwiiXlfA5M1JOeokhtXe1jC2mxyNKD5l973Q8cnT67BwDJjsAPQtozqXC17CaxjLiuSfD42ypf1qYf4KMyCg==
"@pocketpalai/llama.rn@0.4.3-1":
version "0.4.3-1"
resolved "https://registry.yarnpkg.com/@pocketpalai/llama.rn/-/llama.rn-0.4.3-1.tgz#e8e965b55effd9071f900b7dac25396fff9b34b9"
integrity sha512-7L7gou7m91s3fAP9jlKf17De86XRyLUSEw1RTopmSQKuengZHxWcgMESCLIT5y6/u69IzlM6DVjrQUsBb0Om9A==

"@react-native-async-storage/async-storage@^1.23.1":
version "1.24.0"
Expand Down

0 comments on commit d0d5ee2

Please sign in to comment.