RelaxingSnorlax commited on
Commit
d38d8c4
1 Parent(s): aedbf2c

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## llama2.c-stories15M-pruned50
3
+ This repo contains model files for [llama2.c 15M tinystories](https://huggingface.co/Xenova/llama2.c-stories15M) optimized for [NM-vLLM](https://github.com/neuralmagic/nm-vllm), a high-throughput serving engine for compressed LLMs.
4
+
5
+ This model was pruned with [SparseGPT](https://arxiv.org/abs/2301.00774), using [llm-compressor](https://github.com/vllm-project/llm-compressor).
6
+
7
+
8
+ ## Sparsification
9
+
10
+ Install [llm-compressor](https://github.com/vllm-project/llm-compressor):
11
+ ```bash
12
+ pip install llmcompressor
13
+ ```
14
+
15
+ ```python
16
+ from llmcompressor.transformers import oneshot
17
+ from llmcompressor.transformers import SparseAutoModelForCausalLM
18
+
19
+ hf_model_stub = "Xenova/llama2.c-stories15M"
20
+ calibration_dataset = "open_platypus"
21
+ output_directory = f"{hf_model_stub.split('/')[-1]}-pruned_50.2of4-uncompressed"
22
+
23
+ model = SparseAutoModelForCausalLM.from_pretrained(hf_model_stub, torch_dtype="auto", device_map="auto")
24
+
25
+ recipe = """
26
+ test_stage:
27
+ obcq_modifiers:
28
+ SparseGPTModifier:
29
+ sparsity: 0.5
30
+ sequential_update: true
31
+ mask_structure: "2:4"
32
+ targets: ['re:model.layers.\d*$']
33
+ """
34
+
35
+
36
+ oneshot(
37
+ model=model,
38
+ dataset=calibration_dataset,
39
+ recipe=recipe,
40
+ output_dir=output_directory,
41
+ )
42
+
43
+ model.save_pretrained(output_directory, save_compressed=False)
44
+ ```
45
+
46
+ ## Slack
47
+
48
+ For further support, and discussions on these models and AI in general, join [Neural Magic's Slack Community](https://join.slack.com/t/discuss-neuralmagic/shared_invite/zt-q1a1cnvo-YBoICSIw3L1dmQpjBeDurQ)
config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/home/rahul/.cache/huggingface/hub/models--Xenova--llama2.c-stories15M/snapshots/ccdd47c2dc554aeecd2bb4e713e1c988f206a296",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "head_dim": 48,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 288,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 768,
15
+ "max_position_embeddings": 256,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 6,
19
+ "num_hidden_layers": 6,
20
+ "num_key_value_heads": 6,
21
+ "pretraining_tp": 1,
22
+ "quantization_config": {
23
+ "quant_method": "compressed-tensors",
24
+ "sparsity_config": {
25
+ "format": "dense",
26
+ "global_sparsity": 0.12233772669884009,
27
+ "ignore": [
28
+ "lm_head"
29
+ ],
30
+ "registry_requires_subclass": false,
31
+ "sparsity_structure": "2:4",
32
+ "targets": [
33
+ "Linear"
34
+ ]
35
+ },
36
+ "version": "0.7.1"
37
+ },
38
+ "rms_norm_eps": 1e-05,
39
+ "rope_scaling": null,
40
+ "rope_theta": 10000.0,
41
+ "tie_word_embeddings": true,
42
+ "torch_dtype": "float32",
43
+ "transformers_version": "4.45.2",
44
+ "use_cache": true,
45
+ "vocab_size": 32000
46
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.45.2"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3933ab3ff3e2a8c73a21e12402edbb4d1fa6b4e4a424f52d9481ccb9cfb3ae78
3
+ size 60772936
recipe.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ test_stage:
2
+ obcq_modifiers:
3
+ SparseGPTModifier:
4
+ sparsity: 0.5
5
+ sequential_update: true
6
+ mask_structure: '2:4'
7
+ targets: ['re:model.layers.\d*$']
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": true,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": true,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "additional_special_tokens": [],
32
+ "bos_token": "<s>",
33
+ "clean_up_tokenization_spaces": false,
34
+ "eos_token": "</s>",
35
+ "legacy": true,
36
+ "model_max_length": 2048,
37
+ "pad_token": "</s>",
38
+ "sp_model_kwargs": {},
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": true
42
+ }