char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
29f538ac6
char/aliceai-t5-moe
llama.cpp/examples/retrieval
Demonstration of simple retrieval technique based on cosine similarity
More info: https://github.com/ggml-org/llama.cpp/pull/6193
How to use
retieval.cpp has parameters of its own:
--context-file: file to be embedded - state this option multiple times to embed multiple files--chunk-size: minimum size of each text chunk to be embedded--chunk-separator: STRING to divide chunks by. newline by default
retrieval example can be tested as follows:
llama-retrieval --model ./models/bge-base-en-v1.5-f16.gguf--top-k 3--context-file README.md--context-file License--chunk-size 100--chunk-separator .
This chunks and embeds all given files and starts a loop requesting query inputs:
Enter query:
On each query input, top k chunks are shown along with file name, chunk position within file and original text:
Enter query: describe the mit license batch_decode: n_tokens = 6, n_seq = 1 Top 3 similar chunks: filename: README.md filepos: 119 similarity: 0.762334 textdata: png) [](https://opensource.org/licenses/MIT) [Roadmap](https://github. -------------------- filename: License filepos: 0 similarity: 0.725146 textdata: MIT License Copyright (c) 2023 Georgi Gerganov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -------------------- filename: README.md filepos: 9178 similarity: 0.621722 textdata: com/cztomsik/ava) (MIT) - [ptsochantaris/emeltal](https://github.com/ptsochantaris/emeltal) - [pythops/tenere](https://github. --------------------
1# llama.cpp/examples/retrieval 2 3Demonstration of simple retrieval technique based on cosine similarity 4 5More info: 6https://github.com/ggml-org/llama.cpp/pull/6193 7 8### How to use 9 10`retieval.cpp` has parameters of its own: 11- `--context-file`: file to be embedded - state this option multiple times to embed multiple files 12- `--chunk-size`: minimum size of each text chunk to be embedded 13- `--chunk-separator`: STRING to divide chunks by. newline by default 14 15`retrieval` example can be tested as follows: 16 17``` bash 18llama-retrieval --model ./models/bge-base-en-v1.5-f16.gguf --top-k 3 --context-file README.md --context-file License --chunk-size 100 --chunk-separator . 19``` 20 21This chunks and embeds all given files and starts a loop requesting query inputs: 22 23``` 24Enter query: 25``` 26 27On each query input, top k chunks are shown along with file name, chunk position within file and original text: 28 29``` 30Enter query: describe the mit license 31batch_decode: n_tokens = 6, n_seq = 1 32Top 3 similar chunks: 33filename: README.md 34filepos: 119 35similarity: 0.762334 36textdata: 37png) 38 39[](https://opensource.org/licenses/MIT) 40 41[Roadmap](https://github. 42-------------------- 43filename: License 44filepos: 0 45similarity: 0.725146 46textdata: 47MIT License 48 49Copyright (c) 2023 Georgi Gerganov 50 51Permission is hereby granted, free of charge, to any person obtaining a copy 52of this software and associated documentation files (the "Software"), to deal 53in the Software without restriction, including without limitation the rights 54to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 55copies of the Software, and to permit persons to whom the Software is 56furnished to do so, subject to the following conditions: 57 58The above copyright notice and this permission notice shall be included in all 59copies or substantial portions of the Software. 60-------------------- 61filename: README.md 62filepos: 9178 63similarity: 0.621722 64textdata: 65com/cztomsik/ava) (MIT) 66- [ptsochantaris/emeltal](https://github.com/ptsochantaris/emeltal) 67- [pythops/tenere](https://github. 68-------------------- 69```