Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: GeneZC/MiniChat-3B
|
| 3 |
+
inference: false
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
library_name: transformers
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
model_creator: GeneZC
|
| 10 |
+
model_name: MiniChat-3B
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
quantized_by: afrideva
|
| 13 |
+
tags:
|
| 14 |
+
- gguf
|
| 15 |
+
- ggml
|
| 16 |
+
- quantized
|
| 17 |
+
- q2_k
|
| 18 |
+
- q3_k_m
|
| 19 |
+
- q4_k_m
|
| 20 |
+
- q5_k_m
|
| 21 |
+
- q6_k
|
| 22 |
+
- q8_0
|
| 23 |
+
---
|
| 24 |
+
# GeneZC/MiniChat-3B-GGUF
|
| 25 |
+
|
| 26 |
+
Quantized GGUF model files for [MiniChat-3B](https://huggingface.co/GeneZC/MiniChat-3B) from [GeneZC](https://huggingface.co/GeneZC)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
| Name | Quant method | Size |
|
| 30 |
+
| ---- | ---- | ---- |
|
| 31 |
+
| [minichat-3b.q2_k.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q2_k.gguf) | q2_k | 1.30 GB |
|
| 32 |
+
| [minichat-3b.q3_k_m.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q3_k_m.gguf) | q3_k_m | 1.51 GB |
|
| 33 |
+
| [minichat-3b.q4_k_m.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q4_k_m.gguf) | q4_k_m | 1.85 GB |
|
| 34 |
+
| [minichat-3b.q5_k_m.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q5_k_m.gguf) | q5_k_m | 2.15 GB |
|
| 35 |
+
| [minichat-3b.q6_k.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q6_k.gguf) | q6_k | 2.48 GB |
|
| 36 |
+
| [minichat-3b.q8_0.gguf](https://huggingface.co/afrideva/MiniChat-3B-GGUF/resolve/main/minichat-3b.q8_0.gguf) | q8_0 | 3.21 GB |
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
## Original Model Card:
|
| 41 |
+
## MiniChat-3B
|
| 42 |
+
|
| 43 |
+
📑 [arXiv]() | 🤗 [HuggingFace-MiniMA](https://huggingface.co/GeneZC/MiniMA-3B) | 🤗 [HuggingFace-MiniChat](https://huggingface.co/GeneZC/MiniChat-3B) | 🤖 [ModelScope-MiniMA](https://modelscope.cn/models/GeneZC/MiniMA-3B) | 🤖 [ModelScope-MiniChat](https://modelscope.cn/models/GeneZC/MiniChat-3B)
|
| 44 |
+
|
| 45 |
+
❗ Must comply with LICENSE of LLaMA2 since it is derived from LLaMA2.
|
| 46 |
+
|
| 47 |
+
A language model distilled and finetuned from an adapted version of LLaMA2-7B following "Towards the Law of Capacity Gap in Distilling Language Models".
|
| 48 |
+
|
| 49 |
+
Outperforming a wide range of 3B competitors in GPT4 evaluation and even competing with several 7B chat models.
|
| 50 |
+
|
| 51 |
+
<img src="./teaser_b.jpg" alt="teaser_b" width="687" />
|
| 52 |
+
|
| 53 |
+
The following is an example code snippet to use MiniChat-3B:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import torch
|
| 57 |
+
|
| 58 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 59 |
+
|
| 60 |
+
from conversation import get_default_conv_template
|
| 61 |
+
|
| 62 |
+
# MiniChat
|
| 63 |
+
tokenizer = AutoTokenizer.from_pretrained("GeneZC/MiniChat-3B", use_fast=False)
|
| 64 |
+
# GPU.
|
| 65 |
+
model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-3B", use_cache=True, device_map="auto", torch_dtype=torch.float16).eval()
|
| 66 |
+
# CPU.
|
| 67 |
+
# model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-3B", use_cache=True, device_map="cpu", torch_dtype=torch.float16).eval()
|
| 68 |
+
|
| 69 |
+
conv = get_default_conv_template("minichat")
|
| 70 |
+
|
| 71 |
+
question = "Implement a program to find the common elements in two arrays without using any extra data structures."
|
| 72 |
+
conv.append_message(conv.roles[0], question)
|
| 73 |
+
conv.append_message(conv.roles[1], None)
|
| 74 |
+
prompt = conv.get_prompt()
|
| 75 |
+
input_ids = tokenizer([prompt]).input_ids
|
| 76 |
+
output_ids = model.generate(
|
| 77 |
+
torch.as_tensor(input_ids).cuda(),
|
| 78 |
+
do_sample=True,
|
| 79 |
+
temperature=0.7,
|
| 80 |
+
max_new_tokens=1024,
|
| 81 |
+
)
|
| 82 |
+
output_ids = output_ids[0][len(input_ids[0]):]
|
| 83 |
+
output = tokenizer.decode(output_ids, skip_special_tokens=True).strip()
|
| 84 |
+
# output: "def common_elements(arr1, arr2):\n if len(arr1) == 0:\n return []\n if len(arr2) == 0:\n return arr1\n\n common_elements = []\n for element in arr1:\n if element in arr2:\n common_elements.append(element)\n\n return common_elements"
|
| 85 |
+
# Multiturn conversation could be realized by continuously appending questions to `conv`.
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Bibtex
|
| 89 |
+
|
| 90 |
+
```bibtex
|
| 91 |
+
@article{zhang2023law,
|
| 92 |
+
title={Towards the Law of Capacity Gap in Distilling Language Models},
|
| 93 |
+
author={Zhang, Chen and Song, Dawei and Ye, Zheyu and Gao, Yan},
|
| 94 |
+
year={2023},
|
| 95 |
+
url={}
|
| 96 |
+
}
|
| 97 |
+
```
|