Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to llama.cpp git sha 615212 #7

Merged
merged 26 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5588beb
Update to llama.cpp sha 615212
icppWorld Jan 23, 2025
3c82921
build-native : files compile
icppWorld Jan 24, 2025
5cd89f3
format
icppWorld Jan 24, 2025
5ea6d68
mockic.exe builds !!
icppWorld Jan 24, 2025
cc8123f
register CPU backend
icppWorld Jan 25, 2025
47d0a55
Update memory management for model into Orthogonal Persistence
icppWorld Jan 27, 2025
23bbf40
Format
icppWorld Jan 27, 2025
7b79e6f
Default behavior: -no-cnv
icppWorld Jan 27, 2025
528b5ed
Upgrade to icpp-pro 5.0.2
icppWorld Jan 27, 2025
2be9f53
wasm now builds
icppWorld Jan 28, 2025
d5a48a6
free model only once
icppWorld Jan 28, 2025
063b605
Scripts to build & deploy
icppWorld Jan 28, 2025
a663315
tinystories is working in canister!
icppWorld Jan 28, 2025
cc5a326
Some small updates
icppWorld Jan 29, 2025
ba58d3b
Do not call load_model from upload.py
icppWorld Jan 29, 2025
b7bd4cb
Update comment
icppWorld Jan 29, 2025
bf6141d
For clarity, dfx.json uses the .did file in 'build' folder
icppWorld Jan 31, 2025
7ff8fa6
remove_log_file
icppWorld Feb 1, 2025
9c0fc1f
Update native & pytests
icppWorld Feb 1, 2025
4f98e55
CI/CD - use different branch while working on upgrade
icppWorld Feb 1, 2025
0280511
format include
icppWorld Feb 1, 2025
30a6b8c
Update READMEs
icppWorld Feb 2, 2025
81e00f0
Update table of llama.cpp upgrades
icppWorld Feb 2, 2025
5228f76
Running LLMs on-chain solves your cybersecurity problem
icppWorld Feb 2, 2025
121e274
Merge remote-tracking branch 'origin/main' into llama-cpp-615212
icppWorld Feb 2, 2025
3ff73fa
Upgrade to llama.cpp sha 615212
icppWorld Feb 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cicd-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
with:
repository: onicai/llama_cpp_onicai_fork
ref: onicai # Specify the branch name here
# ref: onicai-615212 # While working on the upgrade...
path: src/llama_cpp_onicai_fork
fetch-depth: 1 # Get just the last commit
submodules: 'recursive'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Misc
llama_cpp_onicai_fork
llama_cpp_onicai_fork*
*.code-workspace
x
y
Expand Down
110 changes: 110 additions & 0 deletions README-0001-b841d0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# DETAILS FOR UPGRADE from llama.cpp sha `615212` to `b841d0`

### cpp_paths

#### main_.cpp
`meld main_.cpp llama_cpp_onicai_fork/examples/main/main.cpp`
- use `main_` instead of `main`
- A few items related to console & ctrl+C need to be outcommented


#### llama_cpp_onicai_fork/src/llama.cpp
- add `#include "ic_api.h"`
- replace `throw std::runtime_error(format` with `IC_API::trap(std::string("RUNTIME ERROR: ") + format`
- replace `throw` with `IC_API::trap`
- outcomment `try - catch`. The program will abrupt in case of thrown exceptions.
- outcomment threading related items:
- `#include <future>`
- `#include <mutex>`
- `#include <thread>`
- outcomment these functions completely:
- `llama_tensor_quantize_internal`
- `llama_model_quantize_internal`


#### llama_cpp_onicai_fork/src/llama-vocab.cpp
- add `#include "ic_api.h"`
- replace `throw std::runtime_error(format` with `IC_API::trap(std::string("RUNTIME ERROR: ") + format`
- outcomment `try - catch`. The program will abrupt in case of thrown exceptions.
- add a check on `llama_token_bos(model)`, else the llama2.c models never stop generating:
```
bool llama_token_is_eog_impl(const struct llama_vocab & vocab, llama_token token) {
return token != -1 && (
token == llama_token_eos_impl(vocab) ||
token == llama_token_eot_impl(vocab) ||
token == llama_token_bos_impl(vocab) // ICPP-PATCH: the llama2.c model predicts bos without first predicting an eos
);
}
```

#### llama_cpp_onicai_fork/src/llama-grammar.cpp
No changes needed

#### llama_cpp_onicai_fork/src/llama-sampling.cpp
No changes needed

#### llama_cpp_onicai_fork/src/unicode-data.cpp
- no modifications needed for the IC

#### llama_cpp_onicai_fork/src/unicode.cpp
- add `#include "ic_api.h"`
- replace `throw` with `IC_API::trap`

#### llama_cpp_onicai_fork/common/json-schema-to-grammar.cpp
- add `#include "ic_api.h"`
- replace `throw` with `IC_API::trap`
- outcomment `try - catch`. The program will abrupt in case of thrown exceptions.


#### llama_cpp_onicai_fork/common/build-info.cpp
- run this command to create it:
```
make build-info-cpp-wasm
```

#### llama_cpp_onicai_fork/common/grammar-parser.cpp
- add `#include "ic_api.h"`
- replace `throw` with `IC_API::trap`
- outcomment `try - catch`. The program will abrupt in case of thrown exceptions.

#### llama_cpp_onicai_fork/common/sampling.cpp
- add `#include "ic_api.h"`
- replace `throw` with `IC_API::trap`

#### llama_cpp_onicai_fork/common/common.cpp
- add `#include "ic_api.h"`
- replace `throw` with `IC_API::trap`
- outcomment all code related to `<pthread.h>`
- outcomment `try - catch`. The program will abrupt in case of thrown exceptions.
- outcomment `std::getenv`


---
### c_paths

#### llama_cpp_onicai_fork/ggml/src/ggml.c
- outcomment all code related to signals
- `#include <signal.h>`
- Many threading outcomments.

#### llama_cpp_onicai_fork/ggml/src/ggml-alloc.c
No updates needed for icpp-pro

#### llama_cpp_onicai_fork/ggml/src/ggml-backend.c
No updates needed for icpp-pro

#### llama_cpp_onicai_fork/ggml/src/ggml-quants.c
No updates needed for icpp-pro

#### llama_cpp_onicai_fork/ggml/src/ggml-aarch64.c
No updates needed for icpp-pro

---
### headers to modify

#### llama_cpp_onicai_fork/common/log.h
- `#include <thread>`
- Some other threading code

#### llama_cpp_onicai_fork/common/common.h
- `#include <thread>`
Loading
Loading