Edit model card
TheBlokeAI

TheBloke's LLM work is generously supported by a grant from andreessen horowitz (a16z)


YuLan Chat 2 13B - GGUF

Description

This repo contains GGUF format model files for RUC-GSAI-YuLan's YuLan Chat 2 13B.

About GGUF

GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp. GGUF offers numerous advantages over GGML, such as better tokenisation, and support for special tokens. It is also supports metadata, and is designed to be extensible.

Here is an incomplate list of clients and libraries that are known to support GGUF:

  • llama.cpp. The source project for GGUF. Offers a CLI and a server option.
  • text-generation-webui, the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
  • KoboldCpp, a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
  • LM Studio, an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
  • LoLLMS Web UI, a great web UI with many interesting and unique features, including a full model library for easy model selection.
  • Faraday.dev, an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
  • ctransformers, a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
  • llama-cpp-python, a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
  • candle, a Rust ML framework with a focus on performance, including GPU support, and ease of use.

Repositories available

Prompt template: YulanChat

The following is a conversation between a human and an AI assistant namely YuLan, developed by GSAI, Renmin University of China. The AI assistant gives helpful, detailed, and polite answers to the user's questions.
[|Human|]:{prompt}
[|AI|]:

Licensing

The creator of the source model has listed its license as mit, and this quantization has therefore used that same license.

As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.

In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: RUC-GSAI-YuLan's YuLan Chat 2 13B.

Compatibility

These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit d0cee0d36d5be95a0d9088b674dbb27354107221

They are also compatible with many third party UIs and libraries - please see the list at the top of this README.

Explanation of quantisation methods

Click to see details

The new methods available are:

  • GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
  • GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
  • GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
  • GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
  • GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw

Refer to the Provided Files table below to see what files use which methods, and how.

Provided files

Name Quant method Bits Size Max RAM required Use case
yulan-chat-2-13b.Q2_K.gguf Q2_K 2 5.54 GB 8.04 GB smallest, significant quality loss - not recommended for most purposes
yulan-chat-2-13b.Q3_K_S.gguf Q3_K_S 3 5.78 GB 8.28 GB very small, high quality loss
yulan-chat-2-13b.Q3_K_M.gguf Q3_K_M 3 6.46 GB 8.96 GB very small, high quality loss
yulan-chat-2-13b.Q3_K_L.gguf Q3_K_L 3 7.05 GB 9.55 GB small, substantial quality loss
yulan-chat-2-13b.Q4_0.gguf Q4_0 4 7.50 GB 10.00 GB legacy; small, very high quality loss - prefer using Q3_K_M
yulan-chat-2-13b.Q4_K_S.gguf Q4_K_S 4 7.55 GB 10.05 GB small, greater quality loss
yulan-chat-2-13b.Q4_K_M.gguf Q4_K_M 4 8.00 GB 10.50 GB medium, balanced quality - recommended
yulan-chat-2-13b.Q5_0.gguf Q5_0 5 9.12 GB 11.62 GB legacy; medium, balanced quality - prefer using Q4_K_M
yulan-chat-2-13b.Q5_K_S.gguf Q5_K_S 5 9.12 GB 11.62 GB large, low quality loss - recommended
yulan-chat-2-13b.Q5_K_M.gguf Q5_K_M 5 9.38 GB 11.88 GB large, very low quality loss - recommended
yulan-chat-2-13b.Q6_K.gguf Q6_K 6 10.84 GB 13.34 GB very large, extremely low quality loss
yulan-chat-2-13b.Q8_0.gguf Q8_0 8 14.04 GB 16.54 GB very large, extremely low quality loss - not recommended

Note: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.

How to download GGUF files

Note for manual downloaders: You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.

The following clients/libraries will automatically download models for you, providing a list of available models to choose from:

  • LM Studio
  • LoLLMS Web UI
  • Faraday.dev

In text-generation-webui

Under Download Model, you can enter the model repo: TheBloke/YuLan-Chat-2-13B-GGUF and below it, a specific filename to download, such as: yulan-chat-2-13b.q4_K_M.gguf.

Then click Download.

On the command line, including multiple files at once

I recommend using the huggingface-hub Python library:

pip3 install huggingface-hub>=0.17.1

Then you can download any individual model file to the current directory, at high speed, with a command like this:

huggingface-cli download TheBloke/YuLan-Chat-2-13B-GGUF yulan-chat-2-13b.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
More advanced huggingface-cli download usage

You can also download multiple files at once with a pattern:

huggingface-cli download TheBloke/YuLan-Chat-2-13B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'

For more documentation on downloading with huggingface-cli, please see: HF -> Hub Python Library -> Download files -> Download from the CLI.

To accelerate downloads on fast connections (1Gbit/s or higher), install hf_transfer:

pip3 install hf_transfer

And set environment variable HF_HUB_ENABLE_HF_TRANSFER to 1:

HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/YuLan-Chat-2-13B-GGUF yulan-chat-2-13b.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False

Windows CLI users: Use set HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1 before running the download command.

Example llama.cpp command

Make sure you are using llama.cpp from commit d0cee0d36d5be95a0d9088b674dbb27354107221 or later.

./main -ngl 32 -m yulan-chat-2-13b.q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "The following is a conversation between a human and an AI assistant namely YuLan, developed by GSAI, Renmin University of China. The AI assistant gives helpful, detailed, and polite answers to the user's questions.\n[|Human|]:{prompt}\n[|AI|]:"

Change -ngl 32 to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.

Change -c 4096 to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically.

If you want to have a chat-style conversation, replace the -p <PROMPT> argument with -i -ins

For other parameters and how to use them, please refer to the llama.cpp documentation

How to run in text-generation-webui

Further instructions here: text-generation-webui/docs/llama.cpp.md.

How to run from Python code

You can use GGUF models from Python using the llama-cpp-python or ctransformers libraries.

How to load this model from Python using ctransformers

First install the package

# Base ctransformers with no GPU acceleration
pip install ctransformers>=0.2.24
# Or with CUDA GPU acceleration
pip install ctransformers[cuda]>=0.2.24
# Or with ROCm GPU acceleration
CT_HIPBLAS=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
# Or with Metal GPU acceleration for macOS systems
CT_METAL=1 pip install ctransformers>=0.2.24 --no-binary ctransformers

Simple example code to load one of these GGUF models

from ctransformers import AutoModelForCausalLM

# 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 = AutoModelForCausalLM.from_pretrained("TheBloke/YuLan-Chat-2-13B-GGUF", model_file="yulan-chat-2-13b.q4_K_M.gguf", model_type="llama", gpu_layers=50)

print(llm("AI is going to"))

How to use with LangChain

Here's guides on using llama-cpp-python or ctransformers with LangChain:

Discord

For further support, and discussions on these models and AI in general, join us at:

TheBloke AI's Discord server

Thanks, and how to contribute

Thanks to the chirper.ai team!

Thanks to Clay from gpus.llm-utils.org!

I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.

If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.

Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.

Special thanks to: Aemon Algiz.

Patreon special mentions: 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

Thank you to all my generous patrons and donaters!

And thank you again to a16z for their generous grant.

Original model card: RUC-GSAI-YuLan's YuLan Chat 2 13B

YuLan-Chat: An Open-Source Bilingual Chatbot

YuLan-Chat models are chat-based large language models, which are developed by the researchers in GSAI, Renmin University of China (YuLan, which represents Yulan Magnolia, is the campus flower of Renmin University of China). The newest version is developed by continually-pretraining and instruction-tuning LLaMA-2 with high-quality English and Chinese data. The model has the following technical characteristics:
  • Due to continued pre-training on high-quality Chinese-English bilingual data, the language ability of the model has been improved.
  • To well support Chinese and longer inputs and outputs, we expand the original vocabulary with Chinese words and extend the maximum length of LLaMA-2. It can support 8k context now.
  • To well activate the bilingual instruction following capacity, we construct high-quality bilingual instructions, and perform multi-stage instruction-tuning.

YuLan-Chat系列模型是中国人民大学高瓴人工智能学院师生共同开发的支持聊天的大语言模型(名字"玉兰"取自中国人民大学校花)。最新版本基于LLaMA-2进行了中英文双语的继续预训练和指令微调。该版模型具有如下技术特点:

  • 由于在高质量中英双语数据上进行了继续预训练,模型的语言能力得到提高;
  • 为了更好的支持中文和更长的输入输出,对原版LLaMA-2的词表及长度进行了扩充,目前可支持8k上下文;
  • 为了让模型更好地服从用户指令,构建了高质量双语指令数据集,并行了多阶段指令微调。

Model Zoo

Due to the license limitation, for models based on LLaMA, we only provide the weight difference with the original checkpoints; for models based on LLaMA-2, they can be used directly. Please check the Usage section for more details.

Limitations: Despite our efforts to reduce potential security issues during the model's usage and encourage the generation of text that aligns with ethical and legal requirements, the language model is based on probabilistic generation, which means it may still produce unexpected outputs. For instance, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We do not assume any responsibility for any consequences resulting from the dissemination of harmful information.

由于许可证的限制,基于LLaMA的模型我们仅提供与官方模型的差值,基于LLaMA-2的模型可直接使用,具体请参见使用方法章节。

局限性:尽管我们尝试减少模型在使用中可能出现的安全性问题,并鼓励模型生成符合道德和法律要求的文本,但由于语言模型基于概率生成的范式,模型仍然可能会产生意外的输出。 例如,生成的响应可能包含偏见、歧视或其他有害内容。 请不要传播此类内容。 我们对因传播有害信息而造成的任何后果不承担任何责任。

Model Backbone Extended Vocab Extended Length Continue PT SFT Released Date
YuLan-Chat-2-13B LLaMA2-13B ✅ 51,190 ✅ 8,192 2023.8.2
YuLan-LLaMA-2-13B LLaMA2-13B ✅ 51,190 ✅ 8,192 2023.8.2
YuLan-Chat-1-65B-v2 LLaMA-65B ✅ 51,190 ❌ 2,048 2023.8.2
YuLan-Chat-1-13B-v1 LLaMA-13B ❌ 32,000 ❌ 2,048 2023.6.8
YuLan-Chat-1-65B-v1 LLaMA-65B ❌ 32,000 ❌ 2,048 2023.6.8

Evaluation

We evaluate our YuLan-Chat model on several Chinese and English benchmarks. The evaluation results are shown as follows.

我们在中英文的一些基准测试上对YuLan-Chat进行了评价,其结果如下。

MMLU

MMLU (Massive Multitask Language Understanding) is a benchmark designed to measure knowledge acquired during pretraining by evaluating models exclusively in zero-shot and few-shot settings.

MMLU是一个评估模型知识量的常用的英文基准测试集。

Model STEM Social Science Humanities Others Avg.
YuLan-Chat-1-13B-v1 39.6 57.8 42.6 57.6 49.4
YuLan-Chat-1-65B-v1 49.2 71.7 57.7 66.7 61.3
YuLan-Chat-1-65B-v2 46.3 67.9 56.9 63.9 58.7
LLaMA-2-13B 44.6 64.2 53.9 62.2 56.2
FlagAlpha/Llama2-Chinese-13b-Chat 44.4 63.2 51.6 60.6 55.0
Linly-AI/Chinese-LLaMA-2-13B-hf 43.6 62.7 49.8 61.6 54.4
YuLan-LLaMA-2-13B 42.9 61.5 50.4 58.6 53.4
YuLan-Chat-2-13B 45.3 66.7 53.8 62.8 57.2

C-Eval

C-Eval is a comprehensive Chinese evaluation suite for foundation models.

C-Eval是一个针对基石模型综合能力的中文基准测试集。

Model STEM Social Science Humanities Others Avg. Avg. (Hard)
YuLan-Chat-1-13B-v1 30.2 37.4 31.9 30.7 32.0 25.7
YuLan-Chat-1-65B-v1 37.7 46.1 36.8 38.0 39.2 31.1
YuLan-Chat-1-65B-v2 39.9 55.9 47.7 43.7 45.4 31.4
LLaMA-2-13B 36.9 43.2 37.6 36.6 38.2 32.0
FlagAlpha/Llama2-Chinese-13b-Chat 36.8 44.5 36.3 36.5 38.1 30.9
Linly-AI/Chinese-LLaMA-2-13B-hf 33.7 44.8 36.6 36.5 37 27.7
YuLan-LLaMA-2-13B 35.3 46.4 41.9 37.6 39.3 28.6
YuLan-Chat-2-13B 38.9 49.7 45.0 40.8 42.6 32.2

AGI-Eval-Gaokao

AGI-Eval is a human-centric benchmark specifically designed to evaluate the general abilities of foundation models in tasks pertinent to human cognition and problem-solving. We use the sub-branch Chinese-Gaokao for evaluation.

AGI-Eval 是一个以人为中心的基准,专门设计用于评估基础模型在与人类认知和解决问题相关的任务中的一般能力。我们使用其中的"高考"分支进行评测。

Model Avg. Chinese English Geography History Biology Chemistry Physics Math-QA Math-Cloze
YuLan-Chat-1-13B-v1 24.3 22.4 60.1 27.6 25.5 21.9 30.0 8.0 21.1 1.7
YuLan-Chat-1-65B-v1 29.3 25.2 79.1 37.2 36.6 28.6 24.2 11.0 21.9 0.0
YuLan-Chat-1-65B-v2 37.9 31.4 80.4 50.8 56.6 33.3 29.0 32.0 24.4 0.8
LLaMA-2-13B 32.7 27.2 72.2 36.2 43.0 26.2 32.4 30.0 26.2 0.9
FlagAlpha/Llama2-Chinese-13b-Chat 31.6 26.4 70.6 35.2 38.7 28.1 28.0 29.5 25.6 2.5
Linly-AI/Chinese-LLaMA-2-13B-hf 31.1 22.8 74.8 42.2 37.9 24.3 28.0 23.0 26.5 0.0
YuLan-LLaMA-2-13B 34.2 25.2 70.3 43.2 48.5 30.0 29.5 31.0 28.5 1.7
YuLan-Chat-2-13B 39.5 37.0 85.3 46.7 51.9 43.8 38.2 29.0 23.1 0.9

Usage

Import from Huggingface Transformers

As our model is trained based on LLaMA, it can be loaded in the same way as original LLaMA.

由于我们的模型是基于LLaMA开发的,可以使用与LLaMA相同的方法加载。

>>> from transformers import LlamaTokenizer, LlamaForCausalLM
>>> tokenizer = LlamaTokenizer.from_pretrained("yulan-team/YuLan-Chat-2-13b")
>>> model = LlamaForCausalLM.from_pretrained("yulan-team/YuLan-Chat-2-13b").cuda()
>>> model = model.eval()
>>> input_text = "hello"
>>> prompt = "The following is a conversation between a human and an AI assistant namely YuLan, developed by GSAI, Renmin University of China. The AI assistant gives helpful, detailed, and polite answers to the user's questions.\n[|Human|]:{}\n[|AI|]:".format(input_text)
>>> inputs = tokenizer(prompt, return_tensors='pt', padding="longest", max_length=8192, truncation=True, return_attention_mask=True, add_special_tokens=True)
>>> kwargs = {'temperature': 0.8, 'top_p': 0.95, "top_k": 50, "repetition_penalty": 1.1, "no_repeat_ngram_size": 64, "max_length": 8192, "pad_token_id": tokenizer.bos_token_id, "eos_token_id": tokenizer.eos_token_id}
>>> outputs = model.generate(inputs['input_ids'].to(model.device), attention_mask=inputs['attention_mask'].to(model.device), do_sample=True, **kwargs)
>>> print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[len(prompt):])
Hello! How can I assist you today?

License

YuLan-Chat uses MIT License. All data and code in this project can only be used for academic purposes.

本项目使用MIT许可,所有的数据和代码仅供学术研究使用。

Contributors

Reference

Please kindly cite our work if it helps you.

如果我们的项目对您有帮助,请引用我们,谢谢!

@misc{YuLan-Chat,
  author = {YuLan-Team},
  title = {YuLan-Chat: An Open-Source Bilingual Chatbot},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/RUC-GSAI/YuLan-Chat}},
}
Downloads last month
252
GGUF
Inference API (serverless) has been turned off for this model.

Quantized from