Views
No views yet
1# Install llama.cpp(https://github.com/ggerganov/llama.cpp)
2git clone https://github.com/ggerganov/llama.cpp
3cd llama.cpp
4make
5
6# Install llama-cpp-python(https://github.com/abetlen/llama-cpp-python)
7pip install llama-cpp-python./build/bin/llama-cli -m models/Index-1.9B-Chat/ggml-model-bf16.gguf --color -if1# The three delimiters are <unk>(token_id=0), reserved_0(token_id=3), reserved_1(token_id=4)
2[<unk>]sytem_message[reserved_0]user_message[reserved_1]response1from llama_cpp import Llama
2
3model_path = "Index-1.9B-Chat-GGUF/ggml-model-Q6_K.gguf"
4llm = Llama(model_path =model_path, verbose=True)
5output = llm.create_chat_completion(
6 messages = [
7 {"role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"},
8 #{"role": "system", "content": "你需要扮演B站评论区老哥,用评论区阴阳怪气的话术回复,不要说你是AI"},
9 {"role": "user","content": "篮球和鸡有什么关系"}
10 ]
11)
12print(output)curl -fsSL https://ollama.com/install.sh | sh1# Start server
2ollama serve
3
4# Adaptation model, model file and System Message can be modified in OllamaModelFile
5ollama create Index-1.9B-Chat -f Index-1.9B-Chat-GGUF/OllamaModelFile
6
7# Start Terminal
8ollama run Index-1.9B-Chat
9
10# System Message can be specified dynamically
11curl http://localhost:11434/api/chat -d '{
12 "model": "Index-1.9B-Chat",
13 "messages": [
14 { "role": "system", "content": "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。" },
15 { "role": "user", "content": "续写 金坷垃" }
16 ]
17}'