Felipe97/llama-cpp-compiled
01.1k
1# cvector-generator2 3This example demonstrates how to generate a control vector using gguf models.4 5Related PRs:6- [Add support for control vectors](https://github.com/ggml-org/llama.cpp/pull/5970)7- (Issue) [Generate control vector using llama.cpp](https://github.com/ggml-org/llama.cpp/issues/6880)8- [Add cvector-generator example](https://github.com/ggml-org/llama.cpp/pull/7514)9 10## Examples11 12```sh13# CPU only14./cvector-generator -m ./llama-3.Q4_K_M.gguf15 16# With GPU17./cvector-generator -m ./llama-3.Q4_K_M.gguf -ngl 9918 19# With advanced options20./cvector-generator -m ./llama-3.Q4_K_M.gguf -ngl 99 --pca-iter 2000 --pca-batch 10021 22# Using mean value instead of PCA23./cvector-generator -m ./llama-3.Q4_K_M.gguf --method mean24 25# To see help message26./cvector-generator -h27# Then, have a look at "cvector" section28```29 30## Tips and tricks31 32If you have multiple lines per prompt, you can escape the newline character (change it to `\n`). For example:33 34```35<|im_start|>system\nAct like a person who is extremely happy.<|im_end|>36<|im_start|>system\nYou are in a very good mood today<|im_end|>37```38 39Example to use output file with `llama-cli`:40 41(Tips: The control vector works better when apply to layers higher than 10)42 43```sh44./llama-cli -m ./llama-3.Q4_K_M.gguf -p "<|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nSing a song<|im_end|><|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n" --special --control-vector-scaled ./control_vector.gguf 0.8 --control-vector-layer-range 10 3145```46 