--- inference: false license: other ---
TheBlokeAI

Chat & support: my new Discord server

Want to contribute? TheBloke's Patreon page

# Fire Balloon's Baichuan Vicuna 7B GGML These files are GGML format model files for [Fire Balloon's Baichuan Vicuna 7B](https://huggingface.co./fireballoon/baichuan-vicuna-7b). GGML files are for CPU + GPU inference using [llama.cpp](https://github.com/ggerganov/llama.cpp) and libraries and UIs which support this format, such as: * [text-generation-webui](https://github.com/oobabooga/text-generation-webui) * [KoboldCpp](https://github.com/LostRuins/koboldcpp) * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui) * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) * [ctransformers](https://github.com/marella/ctransformers) ## Repositories available * [4-bit GPTQ models for GPU inference](https://huggingface.co./TheBloke/baichuan-vicuna-7B-GPTQ) * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co./TheBloke/baichuan-vicuna-7B-GGML) * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co./fireballoon/baichuan-vicuna-7b) ## Prompt template: Vicuna 1.1 ``` A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: prompt ASSISTANT: ``` ## Compatibility ### Original llama.cpp quant methods: `q4_0, q4_1, q5_0, q5_1, q8_0` I have quantized these 'original' quantisation methods using an older version of llama.cpp so that they remain compatible with llama.cpp as of May 19th, commit `2d5db48`. These are guaranteed to be compatbile with any UIs, tools and libraries released since late May. ### New k-quant methods: `q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K` These new quantisation methods are compatible with llama.cpp as of June 6th, commit `2d43387`. They are now also compatible with recent releases of text-generation-webui, KoboldCpp, llama-cpp-python and ctransformers. Other tools and libraries may or may not be compatible - check their documentation if in doubt. ## Explanation of the new k-quant methods 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 * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type. 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 | | ---- | ---- | ---- | ---- | ---- | ----- | | baichuan-vicuna-7b.ggmlv3.q2_K.bin | q2_K | 2 | 3.02 GB | 5.52 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.vw and feed_forward.w2 tensors, GGML_TYPE_Q2_K for the other tensors. | | baichuan-vicuna-7b.ggmlv3.q3_K_L.bin | q3_K_L | 3 | 3.76 GB | 6.26 GB | New k-quant method. Uses GGML_TYPE_Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K | | baichuan-vicuna-7b.ggmlv3.q3_K_M.bin | q3_K_M | 3 | 3.45 GB | 5.95 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K | | baichuan-vicuna-7b.ggmlv3.q3_K_S.bin | q3_K_S | 3 | 3.11 GB | 5.61 GB | New k-quant method. Uses GGML_TYPE_Q3_K for all tensors | | baichuan-vicuna-7b.ggmlv3.q4_0.bin | q4_0 | 4 | 3.94 GB | 6.44 GB | Original llama.cpp quant method, 4-bit. | | baichuan-vicuna-7b.ggmlv3.q4_1.bin | q4_1 | 4 | 4.38 GB | 6.88 GB | Original llama.cpp quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. | | baichuan-vicuna-7b.ggmlv3.q4_K_M.bin | q4_K_M | 4 | 4.26 GB | 6.76 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q4_K | | baichuan-vicuna-7b.ggmlv3.q4_K_S.bin | q4_K_S | 4 | 4.01 GB | 6.51 GB | New k-quant method. Uses GGML_TYPE_Q4_K for all tensors | | baichuan-vicuna-7b.ggmlv3.q5_0.bin | q5_0 | 5 | 4.81 GB | 7.31 GB | Original llama.cpp quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. | | baichuan-vicuna-7b.ggmlv3.q5_1.bin | q5_1 | 5 | 5.25 GB | 7.75 GB | Original llama.cpp quant method, 5-bit. Even higher accuracy, resource usage and slower inference. | | baichuan-vicuna-7b.ggmlv3.q5_K_M.bin | q5_K_M | 5 | 4.98 GB | 7.48 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q5_K | | baichuan-vicuna-7b.ggmlv3.q5_K_S.bin | q5_K_S | 5 | 4.85 GB | 7.35 GB | New k-quant method. Uses GGML_TYPE_Q5_K for all tensors | | baichuan-vicuna-7b.ggmlv3.q6_K.bin | q6_K | 6 | 5.74 GB | 8.24 GB | New k-quant method. Uses GGML_TYPE_Q8_K - 6-bit quantization - for all tensors | | baichuan-vicuna-7b.ggmlv3.q8_0.bin | q8_0 | 8 | 7.44 GB | 9.94 GB | Original llama.cpp quant method, 8-bit. Almost indistinguishable from float16. High resource use and slow. Not recommended for most users. | **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 run in `llama.cpp` I use the following command line; adjust for your tastes and needs: ``` ./main -t 10 -ngl 32 -m baichuan-vicuna-7b.ggmlv3.q5_0.bin --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "USER: Write a story about llamas\nASSISTANT:" ``` If you're able to use full GPU offloading, you should use `-t 1` to get best performance. If not able to fully offload to GPU, you should use more cores. Change `-t 10` to the number of physical CPU cores you have, or a lower number depending on what gives best performance. Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration. If you want to have a chat-style conversation, replace the `-p ` argument with `-i -ins` ## How to run in `text-generation-webui` Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md). ## Discord For further support, and discussions on these models and AI in general, join us at: [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD) ## Thanks, and how to contribute. Thanks to the [chirper.ai](https://chirper.ai) team! 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: https://patreon.com/TheBlokeAI * Ko-Fi: https://ko-fi.com/TheBlokeAI **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov. **Patreon special mentions**: Mano Prime, Fen Risland, Derek Yates, Preetika Verma, webtim, Sean Connelly, Alps Aficionado, Karl Bernard, Junyu Yang, Nathan LeClaire, Chris McCloskey, Lone Striker, Asp the Wyvern, Eugene Pentland, Imad Khwaja, trip7s trip, WelcomeToTheClub, John Detwiler, Artur Olbinski, Khalefa Al-Ahmad, Trenton Dambrowitz, Talal Aujan, Kevin Schuppel, Luke Pendergrass, Pyrater, Joseph William Delisle, terasurfer , vamX, Gabriel Puliatti, David Flickinger, Jonathan Leane, Iucharbius , Luke, Deep Realms, Cory Kujawski, ya boyyy, Illia Dulskyi, senxiiz, Johann-Peter Hartmann, John Villwock, K, Ghost , Spiking Neurons AB, Nikolai Manek, Rainer Wilmers, Pierre Kircher, biorpg, Space Cruiser, Ai Maven, subjectnull, Willem Michiel, Ajan Kanaga, Kalila, chris gileta, Oscar Rangel. Thank you to all my generous patrons and donaters! # Original model card: Fire Balloon's Baichuan Vicuna 7B # baichuan-vicuna-7b baichuan-vicuna-7b is a chat model supervised finetuned on vicuna sharegpt data. - The foundation model is [baichuan-7B](https://huggingface.co./baichuan-inc/baichuan-7B), which is a large-scale pre-training model developed by Baichuan Intelligence allowing for commercial purposes. - The finetuning data includes [ShareGPT](https://huggingface.co./datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/blob/main/ShareGPT_V3_unfiltered_cleaned_split.json), mixed with [COT](https://huggingface.co./datasets/QingyiSi/Alpaca-CoT) and [Leetcode](https://www.kaggle.com/datasets/erichartford/leetcode-solutions), which are aimed to improve the model's reasoning and coding ability (the data mixing strategy is inspired by [TULU](https://arxiv.org/abs/2306.04751)). - The training code: https://huggingface.co./fireballoon/baichuan-vicuna-7b/blob/main/train_vicuna.py, which is based on [FastChat](https://github.com/lm-sys/FastChat). [中文说明](#chinese-model-card) **[New]** [baichuan-vicuna-chinese-7b](https://huggingface.co./fireballoon/baichuan-vicuna-chinese-7b), baichuan finetuned on both English and Chinese ShareGPT. # Load model ```python from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fireballoon/baichuan-vicuna-7b", use_fast=False) model = AutoModelForCausalLM.from_pretrained("fireballoon/baichuan-vicuna-7b") ``` # Inference Inference with FastChat: ``` python3 -m fastchat.serve.cli --model-path fireballoon/baichuan-vicuna-7b ``` Inference with Transformers: ```ipython >>> from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer >>> tokenizer = AutoTokenizer.from_pretrained("fireballoon/baichuan-vicuna-7b", use_fast=False) >>> model = AutoModelForCausalLM.from_pretrained("fireballoon/baichuan-vicuna-7b").half().cuda() >>> streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True) >>> instruction = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {} ASSISTANT:" >>> prompt = instruction.format("five tips to help with sleep") # user message >>> generate_ids = model.generate(tokenizer(prompt, return_tensors='pt').input_ids.cuda(), max_new_tokens=2048, streamer=streamer) ''' 1. Create a relaxing bedtime routine, such as winding down with a warm bath or reading a book before bed. 2. Avoid caffeine and alcohol close to bedtime, as they can disrupt sleep. 3. Use blackout curtains or shades to block out light from the outside, which can interfere with your body's natural sleep rhythms. 4. Keep your bedroom cool and dark, and avoid using electronic devices at least an hour before bed. 5. Regular exercise and a healthy diet can also help improve sleep quality. ''' ``` # Test examples on FastChat Eval Test example on [FastChat Eval](https://github.com/lm-sys/FastChat/blob/main/fastchat/eval/table/question.jsonl) Please refer to [discussions 2](https://huggingface.co./fireballoon/baichuan-vicuna-7b/discussions/2) for comparative evaluation of Baichuan-vicuna-7b and Vicuna-13b by GPT-4. ``` Q: How can I improve my time management skills? A: There are many different ways to improve your time management skills. Here are a few strategies that you may find helpful: 1 Prioritize your tasks: Make a list of all the tasks you need to complete and prioritize them based on importance and urgency. This will help you focus on the most important tasks and avoid getting bogged down by less critical items. 2 Use a time management planner: A planner can help you organize your time by breaking down your tasks into smaller, more manageable chunks. This can help you stay focused and on track. 3 Set clear boundaries: Setting clear boundaries between work time and personal time can help you avoid distractions and stay focused on your tasks. This may involve designating certain times of day or days of the week for work and other times for rest and leisure. 4 Take care of your physical and mental health: Taking care of your physical and mental health can help you be more productive and focused. This may involve getting enough sleep, eating a healthy diet, and taking breaks to relax and recharge. Remember that improving your time management skills takes practice and patience. Don't be discouraged if you make mistakes or experience setbacks. Keep trying and you will eventually develop better time management habits that will help you be more productive and successful. ``` ``` Q: Can you help me write a formal email to a potential business partner proposing a joint venture? A: Sure! Here is a sample formal email that you could use as a template to propose a joint venture with a potential business partner: Subject: Proposal for Joint Venture Dear [Business Partner], I hope this email finds you well. I am writing to propose a joint venture between our companies. We believe that a collaboration between our companies could bring significant benefits to both of us, and we would like to explore the possibility of forming a partnership. Our companies have complementary strengths, and we believe that a joint venture could allow us to leverage those strengths to create new products, services, and opportunities. We believe that a joint venture could also provide increased revenue and growth for both of our companies. In order to explore the possibility of a joint venture, we would like to schedule a call to discuss the details of our proposal. During the call, we would like to discuss the terms of the joint venture, including the specific roles and responsibilities of each partner, the financial terms of the agreement, and any other relevant details. I would be happy to schedule a call with you at your convenience. In the meantime, please feel free to contact me with any questions or concerns you may have about our proposal. Sincerely, [Your Name] ``` ``` Q: Implement a binary search algorithm to find a specific element in a sorted array. A: Here is an implementation of the binary search algorithm to find a specific element in a sorted array: public static int binarySearch(int[] arr, int target) { int left = 0; int right = arr.length - 1; while (left <= right) { int mid = left + (right - left) / 2; if (arr[mid] < target) { left = mid + 1; } else if (arr[mid] > target) { right = mid - 1; } else { return mid; } } return -1; // target not found } Here is how the binary search algorithm works: 1 Initialize two pointers, left and right, to the beginning and end of the array, respectively. 2 While the left pointer is less than or equal to the right pointer, perform the following steps: 1 Calculate the middle index, mid, by dividing the left pointer and the right pointer. 2 Check if the middle element, arr[mid], is less than or equal to the target value. 3 If the middle element is less than the target value, update the left pointer to mid + 1. 4 If the middle element is greater than the target value, update the right pointer to mid - 1. 5 If the middle element is equal to the target value, the target element has been found, so return the middle index. 3 If the target element is not found, return -1. This algorithm has a runtime complexity of O(log n) and a space complexity of O(1), making it an efficient way to find a specific element in a sorted array. ``` --- # Chinese model card baichuan-vicuna-7b是在vicuna sharegpt数据上全参数微调的对话模型。 - 基座模型是[baichuan-7B](https://huggingface.co./baichuan-inc/baichuan-7B),由百川智能开发的可商用大规模预训练模型。 - 微调数据包括[ShareGPT](https://huggingface.co./datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/blob/main/ShareGPT_V3_unfiltered_cleaned_split.json),混合一定比例的[COT](https://huggingface.co./datasets/QingyiSi/Alpaca-CoT)和[Leetcode](https://www.kaggle.com/datasets/erichartford/leetcode-solutions)数据以提升模型的推理和代码能力(数据混合策略受到[TULU](https://arxiv.org/abs/2306.04751)研究成果的启发)。 - 训练代码:https://huggingface.co./fireballoon/baichuan-vicuna-7b/blob/main/train_vicuna.py, 代码基于[FastChat](https://github.com/lm-sys/FastChat)。 # Test examples on Ziyan Eval 在[Ziya-Eval-Chinese](https://huggingface.co./datasets/IDEA-CCNL/Ziya-Eval-Chinese)上的测试例子 ``` Q: 鸿门宴是什么意思 A: 鸿门宴是一个汉语成语,意思是指在公元前206年,项羽、刘邦两军在鸿门(今陕西临潼区东北)一带展开的一场“生死对决”。当时,项羽的叔父项伯在会见刘邦的手下时,将刘邦已经逃走的情报透露给项羽,使得刘邦免于被项羽所杀。项羽因此怀恨在心,准备第二天在鸿门设宴,邀请刘邦赴宴,然后袭击刘邦,然而,项羽手下的谋士范增早已看出刘邦的“龙气象” 为刘邦是“沛公刘邦是高祖(刘邦的谥号),他将统率四海,认为杀掉沛公是上策”。宴会期间,项羽的堂弟项庄在席间舞剑,企图将刘邦刺杀。最后,刘邦借故离开,前往韩信大军的营地。鸿门宴上,刘邦因项伯的缘故逃过一劫,但是,他也失项羽议和的机会,为以后楚汉之争埋下了隐患。 Q: 中国目前通用的火警电话是 A: 目前,中国通用的是119火警电话。 ``` ``` Q: 晚上睡不着应该怎么办 A:失眠是一种症状,而不是一种疾病。治疗失眠的目标是解决其潜在原因。失眠的一些常见原因包括: *睡眠不足 *压力 *心理健康问题 (焦虑,抑郁等) *药物 (处方和非处方) *环境因素 (噪音,光线,温度等) 以下是一些通常可以帮助您睡眠的方法: *睡觉前4-6个小时避免刺激物 (咖啡因,尼古丁,酒精) *睡前冥想以减少压力和焦虑 *睡觉前不要看亮屏幕 (电脑,手机,平板电脑等) *睡觉前至少一个小时不要运动 *睡觉前不要吃食物 *在睡觉前放松并平静下来 (看看书,喝杯牛奶等) 如果这些技术不起作用,或者如果失眠是由药物或其他医学状况引起的,您应该联系您的医生。 ```