模型简介
模型特点
模型能力
使用案例
🚀 LlongOrca 7B 16K - GGUF
本项目提供了 Open-Orca的LlongOrca 7B 16K 模型的GGUF格式文件,方便用户进行文本生成任务。

TheBloke的大语言模型工作得到了 andreessen horowitz (a16z) 的慷慨资助
🚀 快速开始
本项目提供了多种格式的模型文件,适用于不同的使用场景和硬件环境。你可以根据自己的需求选择合适的模型文件进行下载和使用。
✨ 主要特性
- 多种量化格式:提供了2、3、4、5、6和8位的GGUF模型,适用于CPU+GPU推理。
- 广泛的兼容性:与llama.cpp、text-generation-webui、KoboldCpp等多种客户端和库兼容。
- 高性能:GGUF格式具有更好的分词效果和对特殊标记的支持,性能优于GGML格式。
📦 安装指南
下载GGUF文件
- 自动下载:LM Studio、LoLLMS Web UI、Faraday.dev等客户端/库会自动下载模型,并提供可用模型列表供你选择。
- 手动下载:不建议克隆整个仓库,因为提供了多种不同的量化格式,大多数用户只需要选择并下载单个文件。
在 text-generation-webui
中下载
在“Download Model”下,输入模型仓库地址 TheBloke/LlongOrca-7B-16K-GGUF
,并在下方输入要下载的具体文件名,如 llongorca-7b-16k.q4_K_M.gguf
,然后点击“Download”。
在命令行下载
推荐使用 huggingface-hub
Python库:
pip3 install huggingface-hub>=0.17.1
然后使用以下命令将单个模型文件高速下载到当前目录:
huggingface-cli download TheBloke/LlongOrca-7B-16K-GGUF llongorca-7b-16k.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
你还可以使用通配符一次性下载多个文件:
huggingface-cli download TheBloke/LlongOrca-7B-16K-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
要在高速连接(1Gbit/s或更高)上加速下载,请安装 hf_transfer
:
pip3 install hf_transfer
并将环境变量 HF_HUB_ENABLE_HF_TRANSFER
设置为 1
:
HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/LlongOrca-7B-16K-GGUF llongorca-7b-16k.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
Windows命令行用户:在运行下载命令前使用 set HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1
。
💻 使用示例
示例 llama.cpp
命令
确保你使用的是 d0cee0d36d5be95a0d9088b674dbb27354107221 或更高版本的 llama.cpp
:
./main -ngl 32 -m llongorca-7b-16k.q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>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/docs/llama.cpp.md。
从Python代码运行
你可以使用 llama-cpp-python 或 ctransformers 库从Python中使用GGUF模型。
使用 ctransformers
从Python加载此模型
首先安装包:
# 无GPU加速的基础ctransformers
pip install ctransformers>=0.2.24
# 或使用CUDA GPU加速
pip install ctransformers[cuda]>=0.2.24
# 或使用ROCm GPU加速
CT_HIPBLAS=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
# 或为macOS系统使用Metal GPU加速
CT_METAL=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
加载GGUF模型的简单示例代码:
from ctransformers import AutoModelForCausalLM
# 将gpu_layers设置为要卸载到GPU的层数。如果你的系统没有GPU加速,请将其设置为0。
llm = AutoModelForCausalLM.from_pretrained("TheBloke/LlongOrca-7B-16K-GGUF", model_file="llongorca-7b-16k.q4_K_M.gguf", model_type="llama", gpu_layers=50)
print(llm("AI is going to"))
与LangChain一起使用
以下是使用 llama-cpp-python
或 ctransformers
与LangChain的指南:
📚 详细文档
关于GGUF
GGUF是llama.cpp团队在2023年8月21日引入的一种新格式,它取代了不再受llama.cpp支持的GGML格式。GGUF具有许多优于GGML的优点,如更好的分词效果和对特殊标记的支持,还支持元数据,并且设计为可扩展的。
以下是已知支持GGUF的客户端和库列表:
- llama.cpp:GGUF的源项目,提供CLI和服务器选项。
- text-generation-webui:最广泛使用的Web UI,具有许多功能和强大的扩展,支持GPU加速。
- KoboldCpp:功能齐全的Web UI,支持所有平台和GPU架构的GPU加速,特别适合讲故事。
- LM Studio:适用于Windows和macOS(Silicon)的易于使用且功能强大的本地GUI,支持GPU加速。
- LoLLMS Web UI:一个很棒的Web UI,具有许多有趣和独特的功能,包括一个完整的模型库,方便选择模型。
- Faraday.dev:一个有吸引力且易于使用的基于角色的聊天GUI,适用于Windows和macOS(Silicon和Intel),支持GPU加速。
- ctransformers:一个Python库,支持GPU加速、LangChain集成和OpenAI兼容的AI服务器。
- llama-cpp-python:一个Python库,支持GPU加速、LangChain集成和OpenAI兼容的API服务器。
- candle:一个Rust机器学习框架,注重性能,包括GPU支持和易用性。
可用的仓库
- 用于GPU推理的AWQ模型
- 用于GPU推理的GPTQ模型,具有多种量化参数选项
- 用于CPU+GPU推理的2、3、4、5、6和8位GGUF模型
- Open-Orca的原始未量化fp16 PyTorch格式模型,用于GPU推理和进一步转换
提示模板:ChatML
<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
兼容性
这些量化的GGUFv2文件与2023年8月27日之后的llama.cpp兼容,对应提交版本为 d0cee0d36d5be95a0d9088b674dbb27354107221。
它们还与许多第三方UI和库兼容,请参阅本README顶部的列表。
量化方法说明
点击查看详情
新的量化方法如下:
- GGML_TYPE_Q2_K:“type-1” 2位量化,超级块包含16个块,每个块有16个权重。块的缩放因子和最小值用4位量化,最终每个权重有效使用2.5625位(bpw)。
- GGML_TYPE_Q3_K:“type-0” 3位量化,超级块包含16个块,每个块有16个权重。缩放因子用6位量化,最终使用3.4375 bpw。
- GGML_TYPE_Q4_K:“type-1” 4位量化,超级块包含8个块,每个块有32个权重。缩放因子和最小值用6位量化,最终使用4.5 bpw。
- GGML_TYPE_Q5_K:“type-1” 5位量化,与GGML_TYPE_Q4_K具有相同的超级块结构,最终使用5.5 bpw。
- GGML_TYPE_Q6_K:“type-0” 6位量化,超级块包含16个块,每个块有16个权重。缩放因子用8位量化,最终使用6.5625 bpw。
请参考下面的“提供的文件”表,了解哪些文件使用了哪些方法以及如何使用。
提供的文件
名称 | 量化方法 | 位数 | 大小 | 所需最大内存 | 使用场景 |
---|---|---|---|---|---|
llongorca-7b-16k.Q2_K.gguf | Q2_K | 2 | 2.83 GB | 5.33 GB | 最小,但质量损失显著,不建议用于大多数场景 |
llongorca-7b-16k.Q3_K_S.gguf | Q3_K_S | 3 | 2.95 GB | 5.45 GB | 非常小,但质量损失高 |
llongorca-7b-16k.Q3_K_M.gguf | Q3_K_M | 3 | 3.30 GB | 5.80 GB | 非常小,但质量损失高 |
llongorca-7b-16k.Q3_K_L.gguf | Q3_K_L | 3 | 3.60 GB | 6.10 GB | 小,但质量损失较大 |
llongorca-7b-16k.Q4_0.gguf | Q4_0 | 4 | 3.83 GB | 6.33 GB | 旧版本;小,但质量损失非常高,建议使用Q3_K_M |
llongorca-7b-16k.Q4_K_S.gguf | Q4_K_S | 4 | 3.86 GB | 6.36 GB | 小,但质量损失较大 |
llongorca-7b-16k.Q4_K_M.gguf | Q4_K_M | 4 | 4.08 GB | 6.58 GB | 中等,质量平衡,推荐使用 |
llongorca-7b-16k.Q5_0.gguf | Q5_0 | 5 | 4.65 GB | 7.15 GB | 旧版本;中等,质量平衡,建议使用Q4_K_M |
llongorca-7b-16k.Q5_K_S.gguf | Q5_K_S | 5 | 4.65 GB | 7.15 GB | 大,质量损失低,推荐使用 |
llongorca-7b-16k.Q5_K_M.gguf | Q5_K_M | 5 | 4.78 GB | 7.28 GB | 大,质量损失非常低,推荐使用 |
llongorca-7b-16k.Q6_K.gguf | Q6_K | 6 | 5.53 GB | 8.03 GB | 非常大,质量损失极低 |
llongorca-7b-16k.Q8_0.gguf | Q8_0 | 8 | 7.16 GB | 9.66 GB | 非常大,质量损失极低,不建议使用 |
注意:上述内存数字假设没有进行GPU卸载。如果将层卸载到GPU,将减少内存使用并使用显存。
🔧 技术细节
原始模型信息
- 模型创建者:Open-Orca
- 基础模型:Open-Orca/LlongOrca-7B-16k
- 模型类型:llama
- 训练数据:使用了来自OpenOrca数据集的经过筛选的GPT-4增强数据的大部分,该数据集旨在重现Orca研究论文的数据集。
- 训练参数:使用8个A6000-48GB(第一代)GPU训练37小时,在一次训练运行中对数据集完成4个完整的微调周期,成本约为200美元。Axolotl训练参数可在 configs/oo7b.yml 中找到,训练期间使用了Axolotl的
packing-attn
分支。
评估结果
- AGIEval性能:与基础Llama2-7B和 Llongma2-7b-16k 相比,在英语写作性能上有近3倍的显著提升,证明了在现有模型上堆叠OpenOrca数据集训练的好处。
- BigBench-Hard性能:与基础Llama2-7B和 Llongma2-7b-16k 相比,有明显提升,证明了在现有模型上堆叠OpenOrca数据集训练的好处。
- HuggingFaceH4开放大语言模型排行榜性能:预计在发布时在所有7B模型中排名第4,在长上下文7B模型中排名第1,性能达到第一名的99%以上。
提示模板
使用 OpenAI的聊天标记语言(ChatML) 格式,并添加了 <|im_start|>
和 <|im_end|>
标记以支持该格式。
示例提示交换
<|im_start|>system
You are LlongOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!
<|im_end|>
<|im_start|>user
How are you<|im_end|>
<|im_start|>assistant
I am doing well!<|im_end|>
<|im_start|>user
How are you now?<|im_end|>
📄 许可证
本项目使用Llama2许可证。
💬 Discord
如需进一步支持,以及讨论这些模型和人工智能相关话题,请加入我们的 TheBloke AI的Discord服务器。
🙏 感谢与贡献
感谢 chirper.ai 团队!感谢来自 gpus.llm-utils.org 的Clay!
很多人询问是否可以贡献。我喜欢提供模型并帮助他人,也希望能花更多时间做这些事,以及开展新的项目,如微调/训练。
如果你有能力且愿意贡献,我将不胜感激,这将帮助我继续提供更多模型,并开展新的人工智能项目。
捐赠者将在所有人工智能/大语言模型/模型问题和请求上获得优先支持,访问私人Discord房间,以及其他福利。
- Patreon: https://patreon.com/TheBlokeAI
- Ko-Fi: https://ko-fi.com/TheBlokeAI
特别感谢:Aemon Algiz。
Patreon特别提及:Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, ϧÄ͵ê ÍπÄ, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, ÈòøÊòé, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
感谢所有慷慨的赞助者和捐赠者!再次感谢a16z的慷慨资助。
📖 引用
@software{lian2023llongorca7b,
title = {LlongOrca7B: Llama2-7B Model Instruct-tuned for Long Context on Filtered OpenOrcaV1 GPT-4 Dataset},
author = {Wing Lian and Bleys Goodson and Guan Wang and Eugene Pentland and Austin Cook and Chanvichet Vong and "Teknium"},
year = {2023},
publisher = {HuggingFace},
journal = {HuggingFace repository},
howpublished = {\url{https://https://huggingface.co/Open-Orca/LlongOrca-7B-16k},
}
@software{openchat,
title = {{OpenChat: Advancing Open-source Language Models with Imperfect Data}},
author = {Wang, Guan and Cheng, Sijie and Yu, Qiying and Liu, Changling},
doi = {10.5281/zenodo.8105775},
url = {https://github.com/imoneoi/openchat},
version = {pre-release},
year = {2023},
month = {7},
}
@misc{mukherjee2023orca,
title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
year={2023},
eprint={2306.02707},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{longpre2023flan,
title={The Flan Collection: Designing Data and Methods for Effective Instruction Tuning},
author={Shayne Longpre and Le Hou and Tu Vu and Albert Webson and Hyung Won Chung and Yi Tay and Denny Zhou and Quoc V. Le and Barret Zoph and Jason Wei and Adam Roberts},
year={2023},
eprint={2301.13688},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
@misc{touvron2023llama,
title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
author={Hugo Touvron and Louis Martin and Kevin Stone and Peter Albert and Amjad Almahairi and Yasmine Babaei and Nikolay Bashlykov and Soumya Batra and Prajjwal Bhargava and Shruti Bhosale and Dan Bikel and Lukas Blecher and Cristian Canton Ferrer and Moya Chen and Guillem Cucurull and David Esiobu and Jude Fernandes and Jeremy Fu and Wenyin Fu and Brian Fuller and Cynthia Gao and Vedanuj Goswami and Naman Goyal and Anthony Hartshorn and Saghar Hosseini and Rui Hou and Hakan Inan and Marcin Kardas and Viktor Kerkez and Madian Khabsa and Isabel Kloumann and Artem Korenev and Punit Singh Koura and Marie-Anne Lachaux and Thibaut Lavril and Jenya Lee and Diana Liskovich and Yinghai Lu and Yuning Mao and Xavier Martinet and Todor Mihaylov and Pushkar Mishra and Igor Molybog and Yixin Nie and Andrew Poulton and Jeremy Reizenstein and Rashi Rungta and Kalyan Saladi and Alan Schelten and Ruan Silva and Eric Michael Smith and Ranjan Subramanian and Xiaoqing Ellen Tan and Binh Tang and Ross Taylor and Adina Williams and Jian Xiang Kuan and Puxin Xu and Zheng Yan and Iliyan Zarov and Yuchen Zhang and Angela Fan and Melanie Kambadur and Sharan Narang and Aurelien Rodriguez and Robert Stojnic and Sergey Edunov and Thomas Scialom},
year={2023},
eprint={2307.09288},
archivePrefix={arXiv},
}



