mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-30 13:24:35 +00:00
1c641e6aac
* `main`/`server`: rename to `llama` / `llama-server` for consistency w/ homebrew
* server: update refs -> llama-server
gitignore llama-server
* server: simplify nix package
* main: update refs -> llama
fix examples/main ref
* main/server: fix targets
* update more names
* Update build.yml
* rm accidentally checked in bins
* update straggling refs
* Update .gitignore
* Update server-llm.sh
* main: target name -> llama-cli
* Prefix all example bins w/ llama-
* fix main refs
* rename {main->llama}-cmake-pkg binary
* prefix more cmake targets w/ llama-
* add/fix gbnf-validator subfolder to cmake
* sort cmake example subdirs
* rm bin files
* fix llama-lookup-* Makefile rules
* gitignore /llama-*
* rename Dockerfiles
* rename llama|main -> llama-cli; consistent RPM bin prefixes
* fix some missing -cli suffixes
* rename dockerfile w/ llama-cli
* rename(make): llama-baby-llama
* update dockerfile refs
* more llama-cli(.exe)
* fix test-eval-callback
* rename: llama-cli-cmake-pkg(.exe)
* address gbnf-validator unused fread warning (switched to C++ / ifstream)
* add two missing llama- prefixes
* Updating docs for eval-callback binary to use new `llama-` prefix.
* Updating a few lingering doc references for rename of main to llama-cli
* Updating `run-with-preset.py` to use new binary names.
Updating docs around `perplexity` binary rename.
* Updating documentation references for lookup-merge and export-lora
* Updating two small `main` references missed earlier in the finetune docs.
* Update apps.nix
* update grammar/README.md w/ new llama-* names
* update llama-rpc-server bin name + doc
* Revert "update llama-rpc-server bin name + doc"
This reverts commit e474ef1df4
.
* add hot topic notice to README.md
* Update README.md
* Update README.md
* rename gguf-split & quantize bins refs in **/tests.sh
---------
Co-authored-by: HanClinto <hanclinto@gmail.com>
70 lines
2.1 KiB
Markdown
70 lines
2.1 KiB
Markdown
# llama.cpp/examples/retrieval
|
|
|
|
Demonstration of simple retrieval technique based on cosine similarity
|
|
|
|
More info:
|
|
https://github.com/ggerganov/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:
|
|
|
|
```bash
|
|
make -j && ./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)
|
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](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.
|
|
--------------------
|
|
```
|