From f7dc43bc0d759732815856183246f167111587ad Mon Sep 17 00:00:00 2001 From: tjohnman Date: Thu, 23 Mar 2023 01:30:23 +0100 Subject: [PATCH 1/7] Fix instruct mode broken by PR #354 (#409) Co-authored-by: Johnman --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 4569ef2a1..431c94b52 100644 --- a/main.cpp +++ b/main.cpp @@ -300,7 +300,7 @@ int main(int argc, char ** argv) { #endif " - Press Return to return control to LLaMa.\n" " - If you want to submit another line, end your input in '\\'.\n\n"); - is_interacting = params.interactive_start; + is_interacting = params.interactive_start || params.instruct; } int input_consumed = 0; From e4412b45e395981068d2850d3fa04cc16c77d70d Mon Sep 17 00:00:00 2001 From: anzz1 Date: Thu, 23 Mar 2023 04:20:34 +0200 Subject: [PATCH 2/7] CI: CMake: Separate build and test steps (#376) * CI: Separate Build and Test steps (CMake) * CI: Make sure build passes before running tests (CMake) * CI: Standardise step id names --- .github/workflows/build.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ce9cc726..e9826a735 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,19 +41,27 @@ jobs: steps: - name: Clone + id: checkout uses: actions/checkout@v1 - name: Dependencies + id: depends run: | sudo apt-get update sudo apt-get install build-essential - name: Build + id: cmake_build run: | mkdir build cd build cmake .. cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build ctest --output-on-failure macOS-latest-make: @@ -79,18 +87,26 @@ jobs: steps: - name: Clone + id: checkout uses: actions/checkout@v1 - name: Dependencies + id: depends run: | brew update - name: Build + id: cmake_build run: | mkdir build cd build cmake -DLLAMA_AVX2=OFF .. cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build ctest --output-on-failure windows-latest-cmake: @@ -108,6 +124,11 @@ jobs: cd build cmake .. cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build ctest -C Release --output-on-failure - name: Get commit hash From 03ace14cfd68a1289ac3b76563534c8ee72a2e53 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 23 Mar 2023 09:48:51 +0200 Subject: [PATCH 3/7] Add link to recent podcast about whisper.cpp and llama.cpp --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b5a113c91..f53595f88 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ docker run -v /llama/models:/models ghcr.io/ggerganov/llama.cpp:light -m /models - Collaborators will be invited based on contributions - Any help with managing issues and PRs is very appreciated! - Make sure to read this: [Inference at the edge](https://github.com/ggerganov/llama.cpp/discussions/205) +- A bit of backstory for those who are interested interested: [Changelog podcast](https://changelog.com/podcast/532) ### Coding guidelines From 93208cfb929c2323e5d2ac6bf354e278040e70ed Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 23 Mar 2023 10:46:58 +0200 Subject: [PATCH 4/7] Adjust repetition penalty .. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f53595f88..f8743e280 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,7 @@ docker run -v /llama/models:/models ghcr.io/ggerganov/llama.cpp:light -m /models - Collaborators will be invited based on contributions - Any help with managing issues and PRs is very appreciated! - Make sure to read this: [Inference at the edge](https://github.com/ggerganov/llama.cpp/discussions/205) -- A bit of backstory for those who are interested interested: [Changelog podcast](https://changelog.com/podcast/532) +- A bit of backstory for those who are interested: [Changelog podcast](https://changelog.com/podcast/532) ### Coding guidelines From 8eea5ae0e5f31238a97c79ea9103c27647380e37 Mon Sep 17 00:00:00 2001 From: anzz1 Date: Thu, 23 Mar 2023 12:26:19 +0200 Subject: [PATCH 5/7] Delete SHA256SUMS for now (#416) Delete this for now to avoid confusion since it contains some wrong checksums from the old tokenizer format Re-add after #374 is resolved --- SHA256SUMS | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 SHA256SUMS diff --git a/SHA256SUMS b/SHA256SUMS deleted file mode 100644 index 532beaea2..000000000 --- a/SHA256SUMS +++ /dev/null @@ -1,53 +0,0 @@ -700df0d3013b703a806d2ae7f1bfb8e59814e3d06ae78be0c66368a50059f33d models/7B/consolidated.00.pth -abe4aec2cdc297e2916011f66c7efd6fb4424e0e84315503005b5c118358cc22 models/7B/ggml-model-f16.bin -f495fa02a0b5ef265e1864d9680eede7fd23a60b0a2f93edba8091e2a4ca68b9 models/7B/ggml-model-q4_0.bin -7e89e242ddc0dd6f060b43ca219ce8b3e8f08959a72cb3c0855df8bb04d46265 models/7B/params.json -745bf4e29a4dd6f411e72976d92b452da1b49168a4f41c951cfcc8051823cf08 models/13B/consolidated.00.pth -d5ccbcc465c71c0de439a5aeffebe8344c68a519bce70bc7f9f92654ee567085 models/13B/consolidated.01.pth -a6bd0537c6873f36c47292df0b6f794e1135f5aafb89c3343bcc9e93264bf167 models/13B/ggml-model-f16.bin -0fb0951b90f2ec46c1f2f2372af5dacb4614b27e9fb6c10c69fbec58d7dd0e36 models/13B/ggml-model-f16.bin.1 -1c218ba37ae61e15e35efd9949c78d6edf553b6280824c263cad56ae0b9d5a8f models/13B/ggml-model-q4_0.bin -c37a20c2ab9fa74b006b389085660269ee06110d1e45a494eb57d4602c9bcdb2 models/13B/ggml-model-q4_0.bin.1 -4ab77bec4d4405ccb66a97b282574c89a94417e3c32e5f68f37e2876fc21322f models/13B/params.json -e23294a58552d8cdec5b7e8abb87993b97ea6eced4178ff2697c02472539d067 models/30B/consolidated.00.pth -4e077b7136c7ae2302e954860cf64930458d3076fcde9443f4d0e939e95903ff models/30B/consolidated.01.pth -24a87f01028cbd3a12de551dcedb712346c0b5cbdeff1454e0ddf2df9b675378 models/30B/consolidated.02.pth -1adfcef71420886119544949767f6a56cb6339b4d5fcde755d80fe68b49de93b models/30B/consolidated.03.pth -def20ea508f4e36793719f857471e85b85f96e497a2cbffbbaa1b60e2b18202c models/30B/ggml-model-f16.bin -b37040aa67fa8608cb2d8e0719132cf3e267fd35ec1e2f0d37dbc9fa43d674f1 models/30B/ggml-model-f16.bin.1 -e7f263557e99069fe29003262ea5fa9ed885dbe79069083e6eb569b328cf30d3 models/30B/ggml-model-f16.bin.2 -2ad6a23af05eb720f202f63d130f4fc5de9b6d2efc95b921be003209a56695aa models/30B/ggml-model-f16.bin.3 -7de31d005e6d02ebd9603b2cf5329ad2f832b65d08873a098c5cafc4046cb9ed models/30B/ggml-model-q4_0.bin -f91feef9f30f9a023616db2e91297ca6d5d5d7b9eb351e452a82115c46f7da9e models/30B/ggml-model-q4_0.bin.1 -66f3a0916ac7a81839153eb061fa861030ed1892477c2f7af2ce4f98d2f6d06f models/30B/ggml-model-q4_0.bin.2 -e3c587ba97f83d2088b001bcda3026571065649ee3090bef6743a51390b01d3b models/30B/ggml-model-q4_0.bin.3 -2c07118ea98d69dbe7810d88520e30288fa994751b337f8fca02b171955f44cb models/30B/params.json -135c563f6b3938114458183afb01adc9a63bef3d8ff7cccc3977e5d3664ecafe models/65B/consolidated.00.pth -9a600b37b19d38c7e43809485f70d17d1dc12206c07efa83bc72bb498a568bde models/65B/consolidated.01.pth -e7babf7c5606f165a3756f527cb0fedc4f83e67ef1290391e52fb1cce5f26770 models/65B/consolidated.02.pth -73176ffb426b40482f2aa67ae1217ef79fbbd1fff5482bae5060cdc5a24ab70e models/65B/consolidated.03.pth -882e6431d0b08a8bc66261a0d3607da21cbaeafa96a24e7e59777632dbdac225 models/65B/consolidated.04.pth -a287c0dfe49081626567c7fe87f74cce5831f58e459b427b5e05567641f47b78 models/65B/consolidated.05.pth -72b4eba67a1a3b18cb67a85b70f8f1640caae9b40033ea943fb166bd80a7b36b models/65B/consolidated.06.pth -d27f5b0677d7ff129ceacd73fd461c4d06910ad7787cf217b249948c3f3bc638 models/65B/consolidated.07.pth -7eba2625260cd91f8de901fd9704a1aa39448425514a335a0d3878de4ab9dc77 models/65B/ggml-model-f16.bin -f6aa886575df0785d4231f30cc776d499ccde18857818effc0378c65b178e0b5 models/65B/ggml-model-f16.bin.1 -076037141682f5d7537955058c4740ab27f285aa4588915f830874a589c0693d models/65B/ggml-model-f16.bin.2 -7853d96d2903ad7de2b2a89c4acf5a33a2f8e3c24ac39c9df6b44cdb42bf530a models/65B/ggml-model-f16.bin.3 -b16b7b941abb3bc03a14df1656140855e9360a5371c83e919b9da83a72362314 models/65B/ggml-model-f16.bin.4 -5291270216f888697695acb78ef28df0c080f9e85d3245c92fb9992d1fde6678 models/65B/ggml-model-f16.bin.5 -0685ee77715f34686841006f8f94d3e7eaf148b97cecc9d3eee72808b0f7989c models/65B/ggml-model-f16.bin.6 -00d993d73bb21d7c29388ffe0dced008cbaa0d391831dea77d7eb8f0b5c404b9 models/65B/ggml-model-f16.bin.7 -4e398f05842206e08cdc5e7bb4f6c7c34b9dc373435ece6f261b14b7b4fe9b89 models/65B/ggml-model-q4_0.bin -4c4e899e3b12d9f57c9dcea5a1fb41bbc72023323535551f6273582ca7d7294b models/65B/ggml-model-q4_0.bin.1 -d7b4594bbbd192043b3db0e5acc2561c42e6944e1cb91cc6e61510eee89dbcd8 models/65B/ggml-model-q4_0.bin.2 -9a099d271648863d923d0d097391ea0bc75591f27a2ca3a327760f42e6b69af2 models/65B/ggml-model-q4_0.bin.3 -5ee474051e418c5732b7949190b084d9d679db447f83c1de0d2a82daaa1a0cfa models/65B/ggml-model-q4_0.bin.4 -a45aa05e7212bd6782790722d68056c5419667ea6b564ccc94bbcb8111d79b8b models/65B/ggml-model-q4_0.bin.5 -a58fda714b759c28ad5e4c1d8bf8fda7b158fd5e4c4a49f851f36342fa97a105 models/65B/ggml-model-q4_0.bin.6 -a3540cfcbcda33c223c6b0d606034adbd78f17e0e5de1582b78795e78754f7a8 models/65B/ggml-model-q4_0.bin.7 -999ed1659b469ccc2a941714c0a9656fa571d17c9f7c8c7589817ca90edef51b models/65B/params.json -1f582babc2bd56bb63b33141898748657d369fd110c4358b2bc280907882bf13 models/alpaca-7B/ggml-model-q4_0.bin -e17730c6b62b565b098af023ca446dcb9e3535d4222ead6369c7aae67207eb3d models/alpaca-13B/ggml-model-q4_0.bin -9bcd1bb30e679c939f367be11b030fe20b3eb9a3606b9bc4106420f1827b6ae4 models/alpaca-30B/ggml-model-q4_0.bin -36079249f53c292a4c2302d7784005dcae94c865f0bedfdbfa51d9ddad402935 models/alpaca-30B/params.json From 8a3e5ef801339e57b9b0449220e9ffb11a6648e2 Mon Sep 17 00:00:00 2001 From: Gary Mulder Date: Thu, 23 Mar 2023 11:30:40 +0000 Subject: [PATCH 6/7] Move model section from issue template to README.md (#421) * Update custom.md * Removed Model section as it is better placed in README.md * Updates to README.md model section * Inserted text that was removed from issue template about obtaining models from FB and links to papers describing the various models * Removed IPF down links for the Alpaca 7B models as these look to be in the old data format and probably shouldn't be directly linked to, anyway * Updated the perplexity section to point at Perplexity scores #406 discussion --- .github/ISSUE_TEMPLATE/custom.md | 19 +++------------ README.md | 40 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md index 72224624c..0d508802d 100644 --- a/.github/ISSUE_TEMPLATE/custom.md +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -44,20 +44,6 @@ $ make --version $ g++ --version ``` -# Models - -* The LLaMA models are officially distributed by Facebook and will never be provided through this repository. See this [pull request in Facebook's LLaMA repository](https://github.com/facebookresearch/llama/pull/73/files) if you need to obtain access to the model data. -* If your issue is with model conversion please verify the `sha256sum` of each of your `consolidated*.pth` and `ggml-model-XXX.bin` files to confirm that you have the correct model data files before logging an issue. [Latest sha256 sums for your reference](https://github.com/ggerganov/llama.cpp/issues/238). -* If your issue is with model generation quality then please at least scan the following links and papers to understand the limitations of LLaMA models. This is especially important when choosing an appropriate model size and appreciating both the significant and subtle differences between LLaMA models and ChatGPT: - * LLaMA: - * [Introducing LLaMA: A foundational, 65-billion-parameter large language model](https://ai.facebook.com/blog/large-language-model-llama-meta-ai/) - * [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971) - * GPT-3 - * [Language Models are Few-Shot Learners](https://arxiv.org/abs/2005.14165) - * GPT-3.5 / InstructGPT / ChatGPT: - * [Aligning language models to follow instructions](https://openai.com/research/instruction-following) - * [Training language models to follow instructions with human feedback](https://arxiv.org/abs/2203.02155) - # Failure Information (for bugs) Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template. @@ -75,8 +61,9 @@ Please provide detailed steps for reproducing the issue. We are not sitting in f Please include any relevant log snippets or files. If it works under one configuration but not under another, please provide logs for both configurations and their corresponding outputs so it is easy to see where behavior changes. -Also, please try to **avoid using screenshots** if at all possible. Instead, copy/paste the console output and use [Github's markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to cleanly format your logs for easy readability. e.g. +Also, please try to **avoid using screenshots** if at all possible. Instead, copy/paste the console output and use [Github's markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to cleanly format your logs for easy readability. +Example environment info: ``` llama.cpp$ git log | head -1 commit 2af23d30434a677c6416812eea52ccc0af65119c @@ -103,8 +90,8 @@ GNU Make 4.3 $ md5sum ./models/65B/ggml-model-q4_0.bin dbdd682cce80e2d6e93cefc7449df487 ./models/65B/ggml-model-q4_0.bin ``` -Here's a run with the Linux command [perf](https://www.brendangregg.com/perf.html) +Example run with the Linux command [perf](https://www.brendangregg.com/perf.html) ``` llama.cpp$ perf stat ./main -m ./models/65B/ggml-model-q4_0.bin -t 16 -n 1024 -p "Please close your issue when it has been answered." main: seed = 1679149377 diff --git a/README.md b/README.md index f8743e280..e486454fe 100644 --- a/README.md +++ b/README.md @@ -191,17 +191,8 @@ Note the use of `--color` to distinguish between user input and generated text. ### Instruction mode with Alpaca -First, download the `ggml` Alpaca model into the `./models` folder: - -``` -# use one of these -# TODO: add a script to simplify the download -curl -o ./models/ggml-alpaca-7b-q4.bin -C - https://gateway.estuary.tech/gw/ipfs/QmUp1UGeQFDqJKvtjbSYPBiZZKRjLp8shVP9hT8ZB9Ynv1 -curl -o ./models/ggml-alpaca-7b-q4.bin -C - https://ipfs.io/ipfs/QmUp1UGeQFDqJKvtjbSYPBiZZKRjLp8shVP9hT8ZB9Ynv1 -curl -o ./models/ggml-alpaca-7b-q4.bin -C - https://cloudflare-ipfs.com/ipfs/QmUp1UGeQFDqJKvtjbSYPBiZZKRjLp8shVP9hT8ZB9Ynv1 -``` - -Now run the `main` tool like this: +1. First, download the `ggml` Alpaca model into the `./models` folder +2. Run the `main` tool like this: ``` ./main -m ./models/ggml-alpaca-7b-q4.bin --color -f ./prompts/alpaca.txt -ins @@ -228,26 +219,34 @@ cadaver, cauliflower, cabbage (vegetable), catalpa (tree) and Cailleach. ### Obtaining and verifying the Facebook LLaMA original model and Stanford Alpaca model data -* The LLaMA models are officially distributed by Facebook and will never be provided through this repository. See this [Pull Request in Facebook's LLaMA repository](https://github.com/facebookresearch/llama/pull/73/files) if you need to obtain access to the model data. - +* The LLaMA models are officially distributed by Facebook and will never be provided through this repository. See this [pull request in Facebook's LLaMA repository](https://github.com/facebookresearch/llama/pull/73/files) if you need to obtain access to the model data. * Please verify the sha256 checksums of all of your `consolidated*.pth` and corresponding converted `ggml-model-*.bin` model files to confirm that you have the correct model data files before creating an issue relating to your model files. +* The following command will verify if you have all possible latest files in your self-installed `./models` subdirectory: -The following command will verify if you have all possible latest files in your self-installed `./models` subdirectory: + `sha256sum --ignore-missing -c SHA256SUMS` on Linux -`sha256sum --ignore-missing -c SHA256SUMS` on Linux + or -or - -`shasum -a 256 --ignore-missing -c SHA256SUMS` on macOS + `shasum -a 256 --ignore-missing -c SHA256SUMS` on macOS +* If your issue is with model generation quality then please at least scan the following links and papers to understand the limitations of LLaMA models. This is especially important when choosing an appropriate model size and appreciating both the significant and subtle differences between LLaMA models and ChatGPT: + * LLaMA: + * [Introducing LLaMA: A foundational, 65-billion-parameter large language model](https://ai.facebook.com/blog/large-language-model-llama-meta-ai/) + * [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971) + * GPT-3 + * [Language Models are Few-Shot Learners](https://arxiv.org/abs/2005.14165) + * GPT-3.5 / InstructGPT / ChatGPT: + * [Aligning language models to follow instructions](https://openai.com/research/instruction-following) + * [Training language models to follow instructions with human feedback](https://arxiv.org/abs/2203.02155) + ### Perplexity (Measuring model quality) You can pass `--perplexity` as a command line option to measure perplexity over the given prompt. For more background, see https://huggingface.co/docs/transformers/perplexity. However, in general, lower perplexity is better for LLMs. -#### Measurements +#### Latest measurements -https://github.com/ggerganov/llama.cpp/pull/270 is the unofficial tracking page for now. llama.cpp is measuring very well +The latest perplexity scores for the various model sizes and quantizations are being tracked in [discussion #406](https://github.com/ggerganov/llama.cpp/discussions/406). `llama.cpp` is measuring very well compared to the baseline implementations. Quantization has a small negative impact to quality, but, as you can see, running 13B at q4_0 beats the 7B f16 model by a significant amount. @@ -347,3 +346,4 @@ docker run -v /llama/models:/models ghcr.io/ggerganov/llama.cpp:light -m /models - There are no strict rules for the code style, but try to follow the patterns in the code (indentation, spaces, etc.). Vertical alignment makes things more readable and easier to batch edit - Clean-up any trailing whitespaces, use 4 spaces indentation, brackets on same line, `void * ptr`, `int & a` - See [good first issues](https://github.com/ggerganov/llama.cpp/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) for tasks suitable for first contributions + From a140219e81cfb80356438112cd2290d701b282bb Mon Sep 17 00:00:00 2001 From: Kerfuffle <44031344+KerfuffleV2@users.noreply.github.com> Date: Thu, 23 Mar 2023 05:41:32 -0600 Subject: [PATCH 7/7] Fix Makefile echo escape codes (by removing them). (#418) --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index edb0c64c8..91eebaebd 100644 --- a/Makefile +++ b/Makefile @@ -231,7 +231,9 @@ clean: main: main.cpp ggml.o llama.o utils.o $(CXX) $(CXXFLAGS) main.cpp ggml.o llama.o utils.o -o main $(LDFLAGS) - @echo "\x1b[36mrun ./main -h for help\x1b[0m" + @echo + @echo '==== Run ./main -h for help. ====' + @echo quantize: quantize.cpp ggml.o llama.o utils.o $(CXX) $(CXXFLAGS) quantize.cpp ggml.o llama.o utils.o -o quantize $(LDFLAGS)