TheBloke 的 LLM 工作得到了 andreessen horowitz (a16z) 慷慨的资助支持
本仓库包含 upstage 的 Solar 10.7B Instruct v1.0 的 GGUF 格式模型文件。
这些文件是使用 Massed Compute 友好提供的硬件进行量化的。
GGUF 是 llama.cpp 团队于 2023 年 8 月 21 日推出的一种新格式。它是 GGML 的替代品,而 GGML 已不再被 llama.cpp 支持。
以下是已知支持 GGUF 的客户端和库的不完全列表:
### User:
{prompt}
### Assistant:
这些量化后的GGUFv2文件兼容2023年8月27日及之后版本的llama.cpp,具体为提交d0cee0d之后的版本。
它们也与许多第三方用户界面和库兼容——详情请参见本README顶部的列表。
可用的新方法包括:
请参考下方的“提供的文件”表格,查看哪些文件使用了哪些方法以及具体方式。
| 名称 | 量化方法 | 位数 | 大小 | 所需最大内存 | 用途 |
|---|---|---|---|---|---|
| solar-10.7b-instruct-v1.0.Q2_K.gguf | Q2_K | 2 | 4.55 GB | 7.05 GB | 体积最小,质量损失显著 - 不推荐大多数场景使用 |
| solar-10.7b-instruct-v1.0.Q3_K_S.gguf | Q3_K_S | 3 | 4.66 GB | 7.16 GB | 体积很小,质量损失高 |
| solar-10.7b-instruct-v1.0.Q3_K_M.gguf | Q3_K_M | 3 | 5.19 GB | 7.69 GB | 体积很小,质量损失高 |
| solar-10.7b-instruct-v1.0.Q3_K_L.gguf | Q3_K_L | 3 | 5.65 GB | 8.15 GB | 体积小,质量损失较大 |
| solar-10.7b-instruct-v1.0.Q4_0.gguf | Q4_0 | 4 | 6.07 GB | 8.57 GB | 旧版格式;体积小,质量损失非常高 - 建议优先使用Q3_K_M |
| solar-10.7b-instruct-v1.0.Q4_K_S.gguf | Q4_K_S | 4 | 6.10 GB | 8.60 GB | 体积小,质量损失较大 |
| solar-10.7b-instruct-v1.0.Q4_K_M.gguf | Q4_K_M | 4 | 6.46 GB | 8.96 GB | 体积中等,质量均衡 - 推荐使用 |
| solar-10.7b-instruct-v1.0.Q5_0.gguf | Q5_0 | 5 | 7.40 GB | 9.90 GB | 旧版格式;体积中等,质量均衡 - 建议优先使用Q4_K_M |
| solar-10.7b-instruct-v1.0.Q5_K_S.gguf | Q5_K_S | 5 | 7.40 GB | 9.90 GB | 体积较大,质量损失低 - 推荐使用 |
| solar-10.7b-instruct-v1.0.Q5_K_M.gguf | Q5_K_M | 5 | 7.60 GB | 10.10 GB | 体积较大,质量损失极低 - 推荐使用 |
| solar-10.7b-instruct-v1.0.Q6_K.gguf | Q6_K | 6 | 8.81 GB | 11.31 GB | 体积非常大,质量损失极小 |
| solar-10.7b-instruct-v1.0.Q8_0.gguf | Q8_0 | 8 | 11.40 GB | 13.90 GB | 体积非常大,质量损失极小 - 不推荐使用 |
注意:上述内存数值假设未使用GPU卸载。如果将层卸载到GPU,则会减少内存使用并改用显存。
手动下载用户注意事项: 您几乎不需要克隆整个仓库!仓库中提供了多种不同的量化格式,大多数用户只需选择并下载单个文件即可。
以下客户端/库将自动为您下载模型,并提供可用模型列表供您选择:
text-generation-webui 中在“下载模型”下,您可以输入模型仓库:TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF,并在其下方输入要下载的特定文件名,例如:solar-10.7b-instruct-v1.0.Q4_K_M.gguf。
然后点击“下载”。
我建议使用 huggingface-hub Python 库:
pip3 install huggingface-hub然后您可以使用如下命令,将任意单个模型文件高速下载到当前目录:
huggingface-cli download TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF solar-10.7b-instruct-v1.0.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False您还可以使用模式一次下载多个文件:
huggingface-cli download TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'有关使用 huggingface-cli 下载的更多文档,请参阅:HF -> Hub Python Library -> Download files -> Download from the CLI。
若要在高速网络(1Gbit/s 或更高)中加快下载速度,请安装 hf_transfer:
pip3 install hf_transfer并将环境变量 HF_HUB_ENABLE_HF_TRANSFER 设置为 1:
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF solar-10.7b-instruct-v1.0.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks FalseWindows 命令行用户:你可以在下载命令前运行 set HF_HUB_ENABLE_HF_TRANSFER=1 来设置环境变量。
llama.cpp command确保你使用的 llama.cpp 来自 commit d0cee0d 或更新版本。
./main -ngl 35 -m solar-10.7b-instruct-v1.0.Q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "### User:\n{prompt}\n\n### Assistant:"将 -ngl 32 更改为要卸载到 GPU 的层数。如果没有 GPU 加速,请将其移除。
将 -c 4096 更改为所需的序列长度。对于扩展序列模型(例如 8K、16K、32K),必要的 RoPE 缩放参数会从 GGUF 文件中读取,并由 llama.cpp 自动设置。请注意,更长的序列长度需要更多资源,因此你可能需要减小此值。
如果你想进行聊天式对话,请将 -p <PROMPT> 参数替换为 -i -ins。
有关其他参数及其使用方法,请参阅 llama.cpp 文档。
text-generation-webui 中运行更多说明可在 text-generation-webui 文档中找到:text-generation-webui/docs/04 ‐ Model Tab.md。
你可以使用 llama-cpp-python 或 ctransformers 库从 Python 中使用 GGUF 模型。请注意,在撰写本文时(2023 年 11 月 27 日),ctransformers 已有一段时间未更新,与某些最新模型不兼容。因此,我建议你使用 llama-cpp-python。
完整文档请参见:llama-cpp-python 文档。
根据你的系统,运行以下命令之一:
# Base ctransformers with no GPU acceleration
pip install llama-cpp-python
# With NVidia CUDA acceleration
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
# Or with OpenBLAS acceleration
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
# Or with CLBLast acceleration
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
# Or with AMD ROCm GPU acceleration (Linux only)
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
# Or with Metal GPU acceleration for macOS systems only
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
pip install llama-cpp-pythonfrom llama_cpp import Llama
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
llm = Llama(
model_path="./solar-10.7b-instruct-v1.0.Q4_K_M.gguf", # Download the model file first
n_ctx=4096, # The max sequence length to use - note that longer sequence lengths require much more resources
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
)
# Simple inference example
output = llm(
"### User:\n{prompt}\n\n### Assistant:", # Prompt
max_tokens=512, # Generate up to 512 tokens
stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
echo=True # Whether to echo the prompt
)
# Chat Completion API
llm = Llama(model_path="./solar-10.7b-instruct-v1.0.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
llm.create_chat_completion(
messages = [
{"role": "system", "content": "You are a story writing assistant."},
{
"role": "user",
"content": "Write a story about llamas."
}
]
)以下是关于如何将 llama-cpp-python 和 ctransformers 与 LangChain 结合使用的指南:
如需进一步支持,或就这些模型及人工智能进行一般性讨论,欢迎加入我们:
感谢 chirper.ai 团队!
感谢来自 gpus.llm-utils.org 的 Clay!
很多人问我是否可以提供帮助。我很乐意提供模型并帮助他人,也希望能有更多时间投入其中,并拓展到模型微调/训练等新项目。
如果您有能力且愿意提供支持,我将不胜感激,这将帮助我继续提供更多模型,并启动新的人工智能项目。
捐赠者将在所有人工智能/大语言模型/模型相关的问题和请求上获得优先支持,可进入 Discord 私人房间,并享受其他福利。
特别感谢:Aemon Algiz。
Patreon 特别鸣谢:Michael Levine、阿明、Trailburnt、Nikolai Manek、John Detwiler、Randy H、Will Dee、Sebastain Graf、NimbleBox.ai、Eugene Pentland、Emad Mostaque、Ai Maven、Jim Angel、Jeff Scroggin、Michael Davis、Manuel Alberto Morcote、Stephen Murray、Robert、Justin Joy、Luke @flexchar、Brandon Frisco、Elijah Stavena、S_X、Dan Guido、Undi .、Komninos Chatzipapas、Shadi、theTransient、Lone Striker、Raven Klaugh、jjj、Cap'n Zoog、Michel-Marie MAUDET (LINAGORA)、Matthew Berman、David、Fen Risland、Omer Bin Jawed、Luke Pendergrass、Kalila、OG、Erik Bjäreholt、Rooh Singh、Joseph William Delisle、Dan Lewis、TL、John Villwock、AzureBlack、Brad、Pedro Madruga、Caitlyn Gatomon、K、jinyuan sun、Mano Prime、Alex、Jeffrey Morgan、Alicia Loh、Illia Dulskyi、Chadd、transmissions 11、fincy、Rainer Wilmers、ReadyPlayerEmma、knownsqashed、Mandus、biorpg、Deo Leter、Brandon Phillips、SuperWojo、Sean Connelly、Iucharbius、Jack West、Harry Royden McLaughlin、Nicholas、terasurfer、Vitor Caleffi、Duane Dunston、Johann-Peter Hartmann、David Ziegler、Olakabola、Ken Nordquist、Trenton Dambrowitz、Tom X Nguyen、Vadim、Ajan Kanaga、Leonard Tan、Clay Pascal、Alexandros Triantafyllidis、JM33133、Xule、vamX、ya boyyy、subjectnull、Talal Aujan、Alps Aficionado、wassieverse、Ari Malik、James Bentley、Woland、Spencer Kim、Michael Dempsey、Fred von Graf、Elle、zynix、William Richards、Stanislav Ovsiannikov、Edmond Seymore、Jonathan Leane、Martin Kemka、usrbinkat、Enrico Ros
感谢所有慷慨的赞助者和捐赠者!
再次感谢 a16z 的慷慨资助。
(本模型是 upstage/SOLAR-10.7B-v1.0 的单轮对话微调版本。详细说明即将补充。)
我们推出了首个拥有 107 亿参数的模型——SOLAR-10.7B。它体型小巧,却性能卓越,在 300 亿参数以下的模型中展现出了无与伦比的最先进性能。
我们研发了深度升级(Depth Up-Scaling)技术。SOLAR-10.7B 以 Llama2 架构为基础,融入了创新的 Upstage 深度升级技术。我们随后将 Mistral 7B 的权重整合到升级后的层中,最后对整个模型进行了持续预训练。
经过深度升级的 SOLAR-10.7B 性能卓越。它优于参数规模高达 300 亿的模型,甚至超越了近期的 Mixtral 8X7B 模型。欲了解详细信息,请参阅实验表格([链接即将更新])。 Solar 10.7B 是微调的理想之选。SOLAR-10.7B 为您的微调需求提供了稳健性和适应性。使用 SOLAR-10.7B 预训练模型进行简单的指令微调,即可带来显著的性能提升。[[链接即将更新]]
本模型主要针对单轮对话进行了微调,因此不太适用于聊天等多轮对话场景。
请确保安装了正确版本的 transformers 库:
pip install transformers==4.35.2使用以下 Python 代码加载模型:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Upstage/SOLAR-10.7B-Instruct-v1.0")
model = AutoModelForCausalLM.from_pretrained(
"Upstage/SOLAR-10.7B-Instruct-v1.0",
device_map="auto",
torch_dtype=torch.float16,
)conversation = [ {'role': 'user', 'content': 'Hello?'} ]
prompt = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, use_cache=True, max_length=4096) output_text = tokenizer.decode(outputs[0])
print(output_text)以下是输出示例。
<s> ### User:
Hello?
### Assistant:
Hello, how can I assist you today? Please feel free to ask any questions or request help with a specific task.</s>Upstage 致力于打造顶尖的 LLM 和 DocAI。更多信息请访问 https://upstage.ai
如有任何问题或建议,请使用讨论标签。若需直接联系我们,请发送邮件至 contact@upstage.ai