jyhong836 commited on
Commit
f32c8e9
·
1 Parent(s): 2ecacc6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ # Compressed LLM Model Zone
6
+
7
+ The models are prepared by [Visual Informatics Group @ University of Texas at Austin (VITA-group)](https://vita-group.github.io/). Credits to Ajay Jaiswal, Zhenyu Zhang, Zhangheng Li, Lu Yin, Shiwei Liu and Junyuan Hong.
8
+
9
+ License: [MIT License](https://opensource.org/license/mit/)
10
+
11
+ Setup environment
12
+ ```shell
13
+ pip install torch==2.0.0+cu117 torchvision==0.15.1+cu117 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu117
14
+ pip install transformers==4.31.0
15
+ pip install accelerate
16
+ pip install auto-gptq # for gptq
17
+ pip install sentencepiece
18
+ ```
19
+
20
+ How to use pruned models
21
+ ```python
22
+ import torch
23
+ from transformers import AutoModelForCausalLM, AutoTokenizer
24
+ base_model = 'llama-2-7b'
25
+ comp_method = 'magnitude_unstructured'
26
+ comp_degree = 0.2
27
+ model_path = f'vita-group/{base_model}_{comp_method}'
28
+ model = AutoModelForCausalLM.from_pretrained(
29
+ model_path,
30
+ revision=f's{comp_degree}',
31
+ torch_dtype=torch.float16,
32
+ low_cpu_mem_usage=True,
33
+ device_map="auto"
34
+ )
35
+ tokenizer = AutoTokenizer.from_pretrained('meta-llama/Llama-2-7b-hf')
36
+ input_ids = tokenizer('Hello! I am a VITA-compressed-LLM chatbot!', return_tensors='pt').input_ids.cuda()
37
+ outputs = model.generate(input_ids, max_new_tokens=128)
38
+ print(tokenizer.decode(outputs[0]))
39
+ ```
40
+
41
+ How to use wanda+gptq models
42
+ ```python
43
+ from transformers import AutoTokenizer
44
+ from auto_gptq import AutoGPTQForCausalLM
45
+ model_path = 'vita-group/llama-2-7b_wanda_2_4_gptq_4bit_128g'
46
+ tokenizer_path = 'meta-llama/Llama-2-7b-hf'
47
+ model = AutoGPTQForCausalLM.from_quantized(
48
+ model_path,
49
+ # inject_fused_attention=False, # or
50
+ disable_exllama=True,
51
+ device_map='auto',
52
+ )
53
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_path, trust_remote_code=True)
54
+ input_ids = tokenizer('Hello! I am a VITA-compressed-LLM chatbot!', return_tensors='pt').input_ids.to('cuda')
55
+ outputs = model.generate(input_ids=input_ids, max_length=128)
56
+ tokenizer.decode(outputs[0])
57
+ ```
58
+
59
+ How to use gptq models
60
+ ```python
61
+ from transformers import AutoTokenizer
62
+ from auto_gptq import AutoGPTQForCausalLM
63
+ # model_path = 'vita-group/llama-2-7b_wanda_2_4_gptq_4bit_128g'
64
+ # tokenizer_path = 'meta-llama/Llama-2-7b-hf'
65
+ model_path = 'vita-group/vicuna-7b-v1.3_gptq'
66
+ tokenizer_path = 'lmsys/vicuna-7b-v1.3'
67
+ model = AutoGPTQForCausalLM.from_quantized(
68
+ model_path,
69
+ # inject_fused_attention=False, # or
70
+ disable_exllama=True,
71
+ device_map='auto',
72
+ revision='2bit_128g',
73
+ )
74
+ from transformers import AutoTokenizer
75
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_path, trust_remote_code=True)
76
+ input_ids = tokenizer('Hello! I am a VITA-compressed-LLM chatbot!', return_tensors='pt').input_ids.to('cuda')
77
+ outputs = model.generate(input_ids=input_ids, max_length=128)
78
+ tokenizer.decode(outputs[0])
79
+ ```
80
+
81
+
82
+ | | Base Model | Model Size | Compression Method | Compression Degree |
83
+ |---:|:-------------|:-------------|:----------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|
84
+ | 0 | Llama-2 | 7b | [magnitude_unstructured](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured) | [s0.1](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured/tree/s0.1) |
85
+ | 1 | Llama-2 | 7b | [magnitude_unstructured](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured) | [s0.2](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured/tree/s0.2) |
86
+ | 2 | Llama-2 | 7b | [magnitude_unstructured](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured) | [s0.3](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured/tree/s0.3) |
87
+ | 3 | Llama-2 | 7b | [magnitude_unstructured](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured) | [s0.5](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured/tree/s0.5) |
88
+ | 4 | Llama-2 | 7b | [magnitude_unstructured](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured) | [s0.6](https://huggingface.co/vita-group/llama-2-7b_magnitude_unstructured/tree/s0.6) |
89
+ | 5 | Llama-2 | 7b | [sparsegpt_unstructured](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured) | [s0.1](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured/tree/s0.1) |
90
+ | 6 | Llama-2 | 7b | [sparsegpt_unstructured](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured) | [s0.2](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured/tree/s0.2) |
91
+ | 7 | Llama-2 | 7b | [sparsegpt_unstructured](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured) | [s0.3](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured/tree/s0.3) |
92
+ | 8 | Llama-2 | 7b | [sparsegpt_unstructured](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured) | [s0.5](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured/tree/s0.5) |
93
+ | 9 | Llama-2 | 7b | [sparsegpt_unstructured](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured) | [s0.6](https://huggingface.co/vita-group/llama-2-7b_sparsegpt_unstructured/tree/s0.6) |
94
+ | 10 | Llama-2 | 7b | [wanda_gptq](https://huggingface.co/vita-group/llama-2-7b_wanda_2_4_gptq_4bit_128g) | 4bit_128g |
95
+ | 11 | Llama-2 | 7b | [wanda_unstructured](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured) | [s0.1](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured/tree/s0.1) |
96
+ | 12 | Llama-2 | 7b | [wanda_unstructured](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured) | [s0.2](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured/tree/s0.2) |
97
+ | 13 | Llama-2 | 7b | [wanda_unstructured](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured) | [s0.3](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured/tree/s0.3) |
98
+ | 14 | Llama-2 | 7b | [wanda_unstructured](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured) | [s0.5](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured/tree/s0.5) |
99
+ | 15 | Llama-2 | 7b | [wanda_unstructured](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured) | [s0.6](https://huggingface.co/vita-group/llama-2-7b_wanda_unstructured/tree/s0.6) |
100
+ | 16 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [10bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/10bit_128g) |
101
+ | 17 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [12bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/12bit_128g) |
102
+ | 18 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [14bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/14bit_128g) |
103
+ | 19 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [2bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/2bit_128g) |
104
+ | 20 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [3bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/3bit_128g) |
105
+ | 21 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [4bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/4bit_128g) |
106
+ | 22 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [6bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/6bit_128g) |
107
+ | 23 | vicuna-v1.3 | 13b | [gptq](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq) | [8bit_128g](https://huggingface.co/vita-group/vicuna-13b-v1.3_gptq/tree/8bit_128g) |
108
+ | 24 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [10bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/10bit_128g) |
109
+ | 25 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [12bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/12bit_128g) |
110
+ | 26 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [14bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/14bit_128g) |
111
+ | 27 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [2bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/2bit_128g) |
112
+ | 28 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [3bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/3bit_128g) |
113
+ | 29 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [4bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/4bit_128g) |
114
+ | 30 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [6bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/6bit_128g) |
115
+ | 31 | vicuna-v1.3 | 7b | [gptq](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq) | [8bit_128g](https://huggingface.co/vita-group/vicuna-7b-v1.3_gptq/tree/8bit_128g) |
116
+
117
+
118
+