Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
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.
Provided files and GPTQ parameters
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the main branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
Explanation of GPTQ parameters
Bits: The bit size of the quantised model.
GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
Act Order: True or False. Also known as desc_act. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
Click the Model tab.
Under Download custom model or LoRA, enter TheBloke/YuLan-Chat-2-13B-GPTQ.
To download from a specific branch, enter for example TheBloke/YuLan-Chat-2-13B-GPTQ:main
see Provided Files above for the list of branches for each option.
Click Download.
The model will start downloading. Once it's finished it will say "Done".
In the top left, click the refresh icon next to Model.
In the Model dropdown, choose the model you just downloaded: YuLan-Chat-2-13B-GPTQ
The model will automatically load, and is now ready for use!
If you want any custom settings, set them and then click Save settings for this model followed by Reload the Model in the top right.
Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file quantize_config.json.
Once you're ready, click the Text Generation tab and enter a prompt to get started!
How to use this GPTQ model from Python code
Install the necessary packages
Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
shell
1pip3 install transformers>=4.32.0 optimum>=1.12.0
2pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
23model_name_or_path ="TheBloke/YuLan-Chat-2-13B-GPTQ"4# To use a different branch, change revision5# For example: revision="main"6model = AutoModelForCausalLM.from_pretrained(model_name_or_path,7 device_map="auto",8 trust_remote_code=False,9 revision="main")1011tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)1213prompt ="Tell me about AI"14prompt_template=f'''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.
15[|Human|]:{prompt}16[|AI|]:
1718'''1920print("\n\n*** Generate:")2122input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()23output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)24print(tokenizer.decode(output[0]))2526# Inference can also be done using transformers' pipeline2728print("*** Pipeline:")29pipe = pipeline(30"text-generation",31 model=model,32 tokenizer=tokenizer,33 max_new_tokens=512,34 do_sample=True,35 temperature=0.7,36 top_p=0.95,37 top_k=40,38 repetition_penalty=1.139)4041print(pipe(prompt_template)[0]['generated_text'])
Compatibility
The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with Occ4m's GPTQ-for-LLaMa fork.
ExLlama is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
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.
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.
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.
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.
As our model is trained based on LLaMA, it can be loaded in the same way as original LLaMA.
由于我们的模型是基于LLaMA开发的,可以使用与LLaMA相同的方法加载。
Python
1>>> from transformers import LlamaTokenizer, LlamaForCausalLM
2>>> tokenizer = LlamaTokenizer.from_pretrained("yulan-team/YuLan-Chat-2-13b")
3>>> model = LlamaForCausalLM.from_pretrained("yulan-team/YuLan-Chat-2-13b").cuda()
4>>> model = model.eval()
5>>> input_text = "hello"
6>>> 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)
7>>> inputs = tokenizer(prompt, return_tensors='pt', padding="longest", max_length=8192, truncation=True, return_attention_mask=True, add_special_tokens=True)
8>>> 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}
9>>> outputs = model.generate(inputs['input_ids'].to(model.device), attention_mask=inputs['attention_mask'].to(model.device), do_sample=True, **kwargs)
10>>> print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[len(prompt):])
11Hello! 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.