TheBloke's picture
Upload README.md
ddfd9ea
|
raw
history blame
32.3 kB
metadata
base_model: cognitivecomputations/yayi2-30b-llama
inference: false
language:
  - zh
  - en
license: other
model_creator: Cognitive Computations
model_name: Yayi2 30B Llama
model_type: yayi2
prompt_template: |
  {prompt}
quantized_by: TheBloke
TheBlokeAI

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


Yayi2 30B Llama - GPTQ

Description

This repo contains GPTQ model files for Cognitive Computations's Yayi2 30B Llama.

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.

These files were quantised using hardware kindly provided by Massed Compute.

Repositories available

Prompt template: None

{prompt}

Known compatible clients / servers

GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.

These GPTQ models are known to work in the following inference servers/webuis.

This may not be a complete list; if you know of others, please let me know!

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.

Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.

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 calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration 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 and Mistral models in 4-bit.
Branch Bits GS Act Order Damp % GPTQ Dataset Seq Len Size ExLlama Desc
main 4 None Yes 0.1 VMware Open Instruct 4096 17.00 GB Yes 4-bit, with Act Order. No group size, to lower VRAM requirements.
gptq-4bit-128g-actorder_True 4 128 Yes 0.1 VMware Open Instruct 4096 17.56 GB Yes 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy.
gptq-4bit-32g-actorder_True 4 32 Yes 0.1 VMware Open Instruct 4096 19.27 GB Yes 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage.
gptq-3bit-128g-actorder_True 3 128 Yes 0.1 VMware Open Instruct 4096 13.88 GB No 3-bit, with group size 128g and act-order. Higher quality than 128g-False.
gptq-8bit--1g-actorder_True 8 None Yes 0.1 VMware Open Instruct 4096 31.61 GB No 8-bit, with Act Order. No group size, to lower VRAM requirements.
gptq-3bit-32g-actorder_True 3 32 Yes 0.1 VMware Open Instruct 4096 15.50 GB No 3-bit, with group size 64g and act-order. Highest quality 3-bit option.
gptq-8bit-128g-actorder_True 8 128 Yes 0.1 VMware Open Instruct 4096 32.29 GB No 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy.

How to download, including from branches

In text-generation-webui

To download from the main branch, enter TheBloke/yayi2-30B-llama-GPTQ in the "Download model" box.

To download from another branch, add :branchname to the end of the download name, eg TheBloke/yayi2-30B-llama-GPTQ:gptq-4bit-128g-actorder_True

From the command line

I recommend using the huggingface-hub Python library:

pip3 install huggingface-hub

To download the main branch to a folder called yayi2-30B-llama-GPTQ:

mkdir yayi2-30B-llama-GPTQ
huggingface-cli download TheBloke/yayi2-30B-llama-GPTQ --local-dir yayi2-30B-llama-GPTQ --local-dir-use-symlinks False

To download from a different branch, add the --revision parameter:

mkdir yayi2-30B-llama-GPTQ
huggingface-cli download TheBloke/yayi2-30B-llama-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir yayi2-30B-llama-GPTQ --local-dir-use-symlinks False
More advanced huggingface-cli download usage

If you remove the --local-dir-use-symlinks False parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: ~/.cache/huggingface), and symlinks will be added to the specified --local-dir, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.

The cache location can be changed with the HF_HOME environment variable, and/or the --cache-dir parameter to huggingface-cli.

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:

mkdir yayi2-30B-llama-GPTQ
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/yayi2-30B-llama-GPTQ --local-dir yayi2-30B-llama-GPTQ --local-dir-use-symlinks False

Windows Command Line users: You can set the environment variable by running set HF_HUB_ENABLE_HF_TRANSFER=1 before the download command.

With git (not recommended)

To clone a specific branch with git, use a command like this:

git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/yayi2-30B-llama-GPTQ

Note that using Git with HF repos is strongly discouraged. It will be much slower than using huggingface-hub, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the .git folder as a blob.)

How to easily download and use this model in text-generation-webui

Please make sure you're using the latest version of text-generation-webui.

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.

  1. Click the Model tab.

  2. Under Download custom model or LoRA, enter TheBloke/yayi2-30B-llama-GPTQ.

    • To download from a specific branch, enter for example TheBloke/yayi2-30B-llama-GPTQ:gptq-4bit-128g-actorder_True
    • see Provided Files above for the list of branches for each option.
  3. Click Download.

  4. The model will start downloading. Once it's finished it will say "Done".

  5. In the top left, click the refresh icon next to Model.

  6. In the Model dropdown, choose the model you just downloaded: yayi2-30B-llama-GPTQ

  7. The model will automatically load, and is now ready for use!

  8. 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.
  9. Once you're ready, click the Text Generation tab and enter a prompt to get started!

Serving this model from Text Generation Inference (TGI)

It's recommended to use TGI version 1.1.0 or later. The official Docker container is: ghcr.io/huggingface/text-generation-inference:1.1.0

Example Docker parameters:

--model-id TheBloke/yayi2-30B-llama-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096

Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):

pip3 install huggingface-hub
from huggingface_hub import InferenceClient

endpoint_url = "https://your-endpoint-url-here"

prompt = "Tell me about AI"
prompt_template=f'''{prompt}
'''

client = InferenceClient(endpoint_url)
response = client.text_generation(
  prompt_template,
  max_new_tokens=128,
  do_sample=True,
  temperature=0.7,
  top_p=0.95,
  top_k=40,
  repetition_penalty=1.1
)

print(f"Model output: {response}")

Python code example: inference from this GPTQ model

Install the necessary packages

Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.

pip3 install --upgrade transformers optimum
# If using PyTorch 2.1 + CUDA 12.x:
pip3 install --upgrade auto-gptq
# or, if using PyTorch 2.1 + CUDA 11.x:
pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/

If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:

pip3 uninstall -y auto-gptq
git clone https://github.com/PanQiWei/AutoGPTQ
cd AutoGPTQ
git checkout v0.5.1
pip3 install .

Example Python code

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_name_or_path = "TheBloke/yayi2-30B-llama-GPTQ"
# To use a different branch, change revision
# For example: revision="gptq-4bit-128g-actorder_True"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
                                             device_map="auto",
                                             trust_remote_code=False,
                                             revision="main")

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)

prompt = "Write a story about llamas"
system_message = "You are a story writing assistant"
prompt_template=f'''{prompt}
'''

print("\n\n*** Generate:")

input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
print(tokenizer.decode(output[0]))

# Inference can also be done using transformers' pipeline

print("*** Pipeline:")
pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.7,
    top_p=0.95,
    top_k=40,
    repetition_penalty=1.1
)

print(pipe(prompt_template)[0]['generated_text'])

Compatibility

The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.

ExLlama is compatible with Llama architecture models (including Mistral, Yi, DeepSeek, SOLAR, etc) in 4-bit. Please see the Provided Files table above for per-file compatibility.

For a list of clients/servers, please see "Known compatible clients / servers", above.

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: 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

Thank you to all my generous patrons and donaters!

And thank you again to a16z for their generous grant.

Original model card: Cognitive Computations's Yayi2 30B Llama

This is wenge-research/yayi2-30b converted to llama compatible format.

Subject to the Yayi 2 license.

Brought to you by @Weyaxi and @ehartford, with thanks to @chargoddard for the pioneering work and the consultation!

And of course thanks to the yayi2 team for sharing an amazing model.

Original card below:

YAYI 2

介绍/Introduction

YAYI 2 是中科闻歌研发的开源大语言模型,包括 Base 和 Chat 版本,参数规模为 30B。YAYI2-30B 是基于 Transformer 的大语言模型,采用了 2.65 万亿 Tokens 的高质量、多语言语料进行预训练。针对通用和特定领域的应用场景,我们采用了百万级指令进行微调,同时借助人类反馈强化学习方法,以更好地使模型与人类价值观对齐。

本次开源的模型为 YAYI2-30B Base 模型。如果您想了解更多关于 YAYI 2 模型的细节,我们建议您参阅 GitHub 仓库。更多技术细节,敬请期待我们的技术报告🔥。

YAYI 2 is a collection of open-source large language models launched by Wenge Technology. YAYI2-30B is a Transformer-based large language model, and has been pretrained for 2.65 trillion tokens of multilingual data with high quality. The base model is aligned with human values through supervised fine-tuning with millions of instructions and reinforcement learning from human feedback (RLHF).

We opensource the pre-trained language model in this release, namely YAYI2-30B. For more details about the YAYI 2, please refer to our GitHub repository. Stay tuned for more technical details in our upcoming technical report! 🔥

模型细节/Model Details

Hyperparameter Value
n_layers 64
n_heads 64
hidden_size 7168
vocab_size 81920
sequence length 4096

要求/Requirements

  • python 3.8及以上版本

  • pytorch 2.0.1 及以上版本

  • 建议使用 CUDA 11.7 及以上版本

  • 运行 BF16 或 FP16 模型需要至少80GB显存(例如1xA100)

  • python 3.8 and above

  • pytorch 2.0.1 and above

  • CUDA 11.7 and above are recommended

  • To run YAYI2-30B in bf16/fp16, at least 80B GPU memory is required (e.g., 1xA100-80G)

快速开始/Quick Start

>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained("wenge-research/yayi2-30b", trust_remote_code=True)
>>> model = AutoModelForCausalLM.from_pretrained("wenge-research/yayi2-30b", device_map="auto", trust_remote_code=True)
>>> inputs = tokenizer('The winter in Beijing is', return_tensors='pt')
>>> inputs = inputs.to('cuda')
>>> pred = model.generate(
        **inputs, 
        max_new_tokens=256, 
        eos_token_id=tokenizer.eos_token_id, 
        do_sample=True,
        repetition_penalty=1.2,
        temperature=0.4, 
        top_k=100, 
        top_p=0.8
        )
>>> print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))

评测结果/Evaluation

我们在多个基准数据集上进行了评测,包括 C-Eval、MMLU、 CMMLU、AGIEval、GAOKAO-Bench、GSM8K、MATH、BBH、HumanEval 以及 MBPP。我们考察了模型在语言理解、学科知识、数学推理、逻辑推理以及代码生成方面的表现。YAYI 2 模型在与其规模相近的开源模型中展现出了显著的性能提升。

We evaluate our model on standard benchmarks, including C-Eval, MMLU, CMMLU, AGIEval, GAOKAO-Bench, GSM8K, MATH, BBH, HumanEval, and MBPP. Our goal is to assess the model's performance in language comprehension, knowledge comprehension, mathematical reasoning, logical reasoning, and code generation. YAYI 2 has demonstrated exceptional performance across models with similar size.

Knowledge Math Logic reasonning Code
Model C-Eval(val) MMLU AGIEval CMMLU GAOKAO-Bench GSM8K MATH BBH HumanEval MBPP
5-shot 5-shot 3/0-shot 5-shot 0-shot 8/4-shot 4-shot 3-shot 0-shot 3-shot
MPT-30B - 46.9 33.8 - - 15.2 3.1 38.0 25.0 32.8
Falcon-40B - 55.4 37.0 - - 19.6 5.5 37.1 0.6 29.8
LLaMA2-34B - 62.6 43.4 - - 42.2 6.2 44.1 22.6 33.0
Baichuan2-13B 59.0 59.5 37.4 61.3 45.6 52.6 10.1 49.0 17.1 30.8
Qwen-14B 71.7 67.9 51.9 70.2 62.5 61.6 25.2 53.7 32.3 39.8
InternLM-20B 58.8 62.1 44.6 59.0 45.5 52.6 7.9 52.5 25.6 35.6
Aquila2-34B 98.5 76.0 43.8 78.5 37.8 50.0 17.8 42.5 0.0 41.0
Yi-34B 81.8 76.3 56.5 82.6 68.3 67.6 15.9 66.4 26.2 38.2
YAYI2-30B 80.9 80.5 62.0 84.0 64.4 71.2 14.8 54.5 53.1 45.8

我们使用 OpenCompass Github 仓库 提供的源代码进行了评测。对于对比模型,我们列出了他们在 OpenCompass 榜单上的评测结果,截止日期为 2023年12月15日。对于其他尚未在 OpenCompass 平台参与评测的模型,包括 MPT、Falcon 和 LLaMa 2,我们采用了 LLaMA 2 报告的结果。

We evaluate our model using the source code from the OpenCompass Github repository. If available, we report results for comparative models assessed by OpenCompass with the evaluation reference date set to Dec. 15th, 2013. For MPT, Falcon, and Llama, which have not been evaluated by OpenCompass, we use the results reported in the LLaMA 2 paper.

协议/License

本项目中的代码依照 Apache-2.0 协议开源,社区使用 YAYI 2 模型和数据需要遵循雅意YAYI 2 模型社区许可协议。若您需要将雅意 YAYI 2系列模型或其衍生品用作商业用途,请根据《雅意 YAYI 2 模型商用许可协议》将商用许可申请登记信息发送至指定邮箱 [email protected]。审核通过后,雅意将授予您商用版权许可,请遵循协议中的商业许可限制。

The code in this project is open-sourced under the Apache-2.0 license. The use of YaYi series model weights and data must adhere to the YAYI 2 Community License. If you intend to use the YAYI 2 series models or their derivatives for commercial purposes, please submit your commercial license application and registration information to [email protected], following the YAYI 2 Commercial License. Upon approval, YAYI will grant you a commercial copyright license, subject to the commercial license restrictions outlined in the agreement.

引用/Citation

如果您在工作中使用了我们的模型,请引用我们的论文。

If you are using the resource for your work, please cite our paper.

@article{YAYI 2,
  author    = {Yin Luo, Qingchao Kong, Nan Xu, et.al.},
  title     = {YAYI 2: Multilingual Open Source Large Language Models},
  journal   = {arXiv preprint arXiv},
  year      = {2023}
}