
---license: Apache License 2.0 tasks:- Large Language Models---#### Clone with HTTP在个人中心->模型->我的模型,查询访问令牌。可以通过令牌进行git仓库的使用。```bash git clone http://git.aistudio.baidu.com/aistudio/Baichuan2-7B-Base.git```**baichuan-inc_Baichuan2-7B-Base**Baichuan 2 是[百川智能]推出的新一代开源大语言模型,采用 **2.6 万亿** Tokens 的高质量语料训练,在权威的中文和英文 benchmark上均取得同尺寸最好的效果。本次发布包含有 7B、13B 的 Base 和 Chat 版本,并提供了 Chat 版本的 4bits量化,所有版本不仅对学术研究完全开放,开发者也仅需[邮件申请]并获得官方商用许可后,即可以免费商用。具体发布版本和下载见下表:Baichuan 2 is the new generation of large-scale open-source language models launched by [Baichuan Intelligence inc.](https://www.baichuan-ai.com/). It is trained on a high-quality corpus with 2.6 trillion tokens and has achieved the best performance in authoritative Chinese and English benchmarks of the same size. This release includes 7B and 13B versions for both Base and Chat models, along with a 4bits quantized version for the Chat model. All versions are fully open to academic research, and developers can also use them for free in commercial applications after obtaining an official commercial license through [email request](mailto:opensource@baichuan-inc.com). The specific release versions and download links are listed in the table below:| | Base Model | Chat Model | 4bits Quantized Chat Model ||:---:|:--------------------:|:--------------------:|:--------------------------:|| 7B | [Baichuan2-7B-Base](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base) | [Baichuan2-7B-Chat](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat) | [Baichuan2-7B-Chat-4bits](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base-4bits) || 13B | [Baichuan2-13B-Base](https://huggingface.co/baichuan-inc/Baichuan2-13B-Base) | [Baichuan2-13B-Chat](https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat) | [Baichuan2-13B-Chat-4bits](https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits) |### 快速上手```pythonfrom paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizermodel = AutoModelForCausalLM.from_pretrained( "aistudio/Baichuan2-7B-Base", from_aistudio=True)tokenizer = AutoTokenizer.from_pretrained( "aistudio/Baichuan2-7B-Base", from_aistudio=True)query = "登鹳雀楼->王之涣\n夜雨寄北->"inputs = tokenizer(query, return_tensors="pd")generate_ids = model.generate( **inputs, do_sample=True, max_new_tokens=2048, top_k=10, top_p=0.85, temperature=1, repetition_penalty=1.15, eos_token_id=2, bos_token_id=1, pad_token_id=0,)[0]print(generate_ids)response = tokenizer.batch_decode(generate_ids)[0]print(response)```### 训压推全流程请参考[飞桨大语言模型工具链](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm)以及其中中的[类LLaMA模型文档](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/llama)### 相关论文以及引用信息```@article{baichuan2023baichuan2, title={Baichuan 2: Open Large-scale Language Models}, author={Baichuan}, journal={arXiv preprint arXiv:2309.10305}, url={https://arxiv.org/abs/2309.10305}, year={2023}}```