Vinnnf commited on
Commit
5ee8070
·
verified ·
1 Parent(s): 455ae3f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - allenai/c4
4
+ base_model:
5
+ - meta-llama/Llama-3.1-8B
6
+ library_name: transformers
7
+ ---
8
+
9
+ # MaskLLM: Learnable Semi-structured Sparsity for Large Language Models
10
+
11
+ <div align="center">
12
+ <figure>
13
+ <img src="https://github.com/NVlabs/MaskLLM/blob/main/assets/teaser.png?raw=true" style="width:70%; display:block; margin-left:auto; margin-right:auto;"
14
+ </figure>
15
+ </div>
16
+
17
+ This work introduces [MaskLLM](https://github.com/NVlabs/MaskLLM), a **learnable** pruning method that establishes **Semi-structured (or ``N:M'') Sparsity** in LLMs, aimed at reducing computational overhead during inference. The proposed method is scalable and stands to benefit from larger training datasets.
18
+
19
+ ## Requirements
20
+ We provide pre-computed masks for Huggingface Models such as Llama-2 7B and Llama-3 8B with the minimum requirements. It will not involve docker, Megatron or data preprocessing.
21
+ ```bash
22
+ pip install transformers accelerate datasets SentencePiece
23
+ ```
24
+
25
+ ## Pre-computed Masks
26
+
27
+ The following masks were trained and provided by [@VainF](https://github.com/VainF). We use ``huggingface_hub`` to automatically download those masks and apply them to offcical LLMs for evaluation. Those mask files were compressed using [numpy.savez_compressed](tool_compress_mask.py). More results for baselines (SparseGPT, Wanda) can be found in the appendix.
28
+ | Model | Pattern | Training Data | Training/Eval SeqLen | PPL (Dense) | PPL (SparseGPT) | **PPL (MaskLLM)** | Link |
29
+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
30
+ | LLaMA-2 7B | 2:4 | C4 (2B Tokens)| 4096 | 5.12 | 10.42 | **6.78** | [HuggingFace](https://huggingface.co/Vinnnf/LLaMA-2-7B-MaskLLM-C4) |
31
+ | LLaMA-3 8B | 2:4 | C4 (2B Tokens) | 4096 | 5.75 | 17.64 | **8.49** | [HuggingFace](https://huggingface.co/Vinnnf/LLaMA-3-8B-MaskLLM-C4) |
32
+ | LLaMA-3.1 8B | 2:4 | C4 (2B Tokens) | 4096 | 5.89 | 18.65 | **8.58** | [HuggingFace](https://huggingface.co/Vinnnf/LLaMA-3.1-8B-MaskLLM-C4) |
33
+
34
+ ## How to use it
35
+
36
+ Please see [NVlabs/MaskLLM](https://github.com/NVlabs/MaskLLM?tab=readme-ov-file#1-pre-trained-masks-for-hugging-face-models-).