llama.cpp Installation et déploiement du processeur Windows du modèle LLM ; exécutez le test du modèle LLaMA2

Référence :
https://www.listera.top/ji-xu-zhe-teng-xia-chinese-llama-alpaca/
https://blog.csdn.net/qq_38238956/article/details/130113599

référence d'installation cmake windows : https://blog.csdn.net/weixin_42357472/article/details/131314105

télécharger et compiler lama.cpp

1. Télécharger :

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp

2. Compiler

mkdir build
cd build
cmake ..
cmake --build . --config Release

insérez la description de l'image ici

3. Essai de fonctionnement

cd bin\Release
./main -h

insérez la description de l'image ici

Exécutez le test du modèle LLaMA-7B

Référence :
https://zhuanlan.zhihu.com/p/638427280

Téléchargement du modèle :
https://huggingface.co/nyanko7/LLaMA-7B/tree/main
Après le téléchargement, créez le répertoire LLamda\7B sous llama.cpp-master\models\
insérez la description de l'image ici
1. convertissez le modèle 7B au format ggml FP16
convert Le fichier .py est sous llama.cpp-master

python3 convert.py models/7B/

insérez la description de l'image ici
2. Quantize quantize le modèle à 4 bits (en utilisant la méthode q4_0)
quantize.exe sous llama.cpp-master\build\bin\Release ; le volume après quantification est d'environ 13G à moins de 4G

 .\quantize.exe D:\llm\llama.cpp-master\models\LLamda\7B\ggml-model-f16.bin  D:\llm\llama.cpp-master\models\LLamda\7B\ggml-model-q4_0.bin  q4_0

insérez la description de l'image ici
3. Exécutez
main.exe de manière interactive sur la ligne de commande sous llama.cpp-master\build\bin\Release

 .\main.exe -m D:\llm\llama.cpp-master\models\LLamda\7B\ggml-model-q4_0.bin  -n 128  --repeat_penalty 1.0 --color -i -r "User:" -f D:\llm\llama.cpp-master\prompts\chat-with-bob.txt

Le support chinois LLaMA n'est pas très bon, bien que je puisse comprendre à peu près le sens, si vous avez besoin d'un support chinois, vous devrez peut-être choisir d'autres modèles
insérez la description de l'image ici

Vous pouvez également télécharger directement le modèle ggml converti tiers, Llama-2

Adresse de référence :
https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML
https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML

Le fonctionnement de Windows consomme beaucoup de mémoire, 32g est fondamentalement plein et la vitesse de génération est également très lente; mais le modèle de génération 13b lama-2 peut répondre directement au chinois

##运行
.\main.exe -m "C:\Users\loong\Downloads\llama-2-13b-chat.ggmlv3.q4_0.bin"  -n 128  --repeat_penalty 1.0 --color -i -r "User:" -f D:\llm\llama.cpp-master\prompts\chat-with-bob.txt

insérez la description de l'image ici

Chinese-Llama-2 Chinois deuxième génération

Téléchargement du modèle :
https://huggingface.co/soulteary/Chinese-Llama-2-7b-ggml-q4

##运行
 .\main.exe -m "C:\Users\loong\Downloads\Chinese-Llama-2-7b-ggml-q4.bin"  -n 128  --repeat_penalty 1.0 --color -i -r "User:" -f D:\llm\llama.cpp-master\prompts\chat-with-bob.txt

insérez la description de l'image ici

Je suppose que tu aimes

Origine blog.csdn.net/weixin_42357472/article/details/131313977
conseillé
Classement