初始化项目,由ModelHub XC社区提供模型
Model: RedHatAI/Llama-2-7b-ultrachat200k-pruned_70 Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
70
README.md
Normal file
70
README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
base_model: neuralmagic/Llama-2-7b-pruned70-retrained
|
||||
inference: true
|
||||
model_type: llama
|
||||
pipeline_tag: text-generation
|
||||
datasets:
|
||||
- cerebras/SlimPajama-627B
|
||||
- HuggingFaceH4/ultrachat_200k
|
||||
tags:
|
||||
- sparse
|
||||
- chat
|
||||
---
|
||||
|
||||
# Llama-2-7b-pruned70-retrained-ultrachat
|
||||
|
||||
This repo contains a [70% sparse Llama 2 7B](https://huggingface.co/neuralmagic/Llama-2-7b-pruned70-retrained) finetuned for chat tasks using the [UltraChat 200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) dataset.
|
||||
|
||||
Official model weights from [Enabling High-Sparsity Foundational Llama Models with Efficient Pretraining and Deployment](https://arxiv.org/abs/2405.03594).
|
||||
|
||||
**Authors**: Neural Magic, Cerebras
|
||||
|
||||
## Usage
|
||||
|
||||
Below we share some code snippets on how to get quickly started with running the model.
|
||||
|
||||
### Sparse Transfer
|
||||
|
||||
By leveraging a pre-sparsified model's structure, you can efficiently fine-tune on new data, leading to reduced hyperparameter tuning, training times, and computational costs. Learn about this process [here](https://neuralmagic.github.io/docs-v2/get-started/transfer).
|
||||
|
||||
### Running the model
|
||||
|
||||
This model may be run with the transformers library. For accelerated inference with sparsity, deploy with [nm-vllm](https://github.com/neuralmagic/nm-vllm) or [deepsparse](https://github.com/neuralmagic/deepsparse).
|
||||
|
||||
```python
|
||||
# pip install transformers accelerate
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained("neuralmagic/Llama-2-7b-pruned70-retrained-ultrachat")
|
||||
model = AutoModelForCausalLM.from_pretrained("neuralmagic/Llama-2-7b-pruned70-retrained-ultrachat", device_map="auto")
|
||||
|
||||
input_text = "Write me a poem about Machine Learning."
|
||||
input_ids = tokenizer.apply_chat_template(input_text, add_generation_prompt=True, return_tensors="pt").to("cuda")
|
||||
|
||||
outputs = model.generate(**input_ids)
|
||||
print(tokenizer.decode(outputs[0]))
|
||||
```
|
||||
|
||||
## Evaluation Benchmark Results
|
||||
|
||||
Model evaluation metrics and results.
|
||||
|
||||
| Benchmark | Metric | Llama-2-7b-ultrachat | Llama-2-7b-pruned70-retrained-ultrachat |
|
||||
|------------------------------------------------|---------------|-------------|-------------------------------|
|
||||
| [MMLU](https://arxiv.org/abs/2009.03300) | 5-shot | 46.1% | 32.5% |
|
||||
| [HellaSwag](https://arxiv.org/abs/1905.07830) | 0-shot | 75.9% | 68.9% |
|
||||
| [WinoGrande](https://arxiv.org/abs/1907.10641) | 5-shot | 72.6% | 65.1% |
|
||||
| [ARC-c](https://arxiv.org/abs/1911.01547) | 25-shot | 52.8% | 45.3% |
|
||||
| [TruthfulQA](https://arxiv.org/abs/2109.07958) | 5-shot | 44.8% | 39.6% |
|
||||
| [GSM8K](https://arxiv.org/abs/2110.14168) | 5-shot | 12.4% | 4.8% |
|
||||
| [AlpacaEval](https://arxiv.org/abs/2107.03374) ([Llama-2-70b-chat-hf](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) evaluator) | Win rate | 57.6% | 57.4% |
|
||||
| [AlpacaEval](https://arxiv.org/abs/2107.03374) (GPT-4 Turbo evaluator) | Win rate | 60.6% | 54.0% |
|
||||
|
||||
## Model Training Details
|
||||
|
||||
This model was obtained by sparse-tranfer of the sparse foundational model [Llama-2-7b-pruned70-retrained](https://huggingface.co/neuralmagic/Llama-2-7b-pruned70-retrained) on the [ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) dataset.
|
||||
Training was performed for 2 epochs and used the [SquareHead](https://arxiv.org/abs/2310.06927) knowledge distillation with [Llama-2-7b-ultrachat](https://huggingface.co/neuralmagic/Llama-2-7b-ultrachat) as teacher.
|
||||
|
||||
## Help
|
||||
|
||||
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)
|
||||
25
arc_challenge_25shot_bs16_bf16.json
Normal file
25
arc_challenge_25shot_bs16_bf16.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"results": {
|
||||
"arc_challenge": {
|
||||
"acc": 0.4232081911262799,
|
||||
"acc_stderr": 0.014438036220848027,
|
||||
"acc_norm": 0.45307167235494883,
|
||||
"acc_norm_stderr": 0.01454689205200563
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"arc_challenge": 0
|
||||
},
|
||||
"config": {
|
||||
"model": "sparseml",
|
||||
"model_args": "pretrained=/network/alexandre/research/cerebras/llama2_7B_sparse70_retrained/ultrachat200k/llama2_7B_sparse70_LR3e-4_GC2_E2/training,dtype=bfloat16",
|
||||
"num_fewshot": 25,
|
||||
"batch_size": "16",
|
||||
"batch_sizes": [],
|
||||
"device": "cuda:1",
|
||||
"no_cache": true,
|
||||
"limit": null,
|
||||
"bootstrap_iters": 100000,
|
||||
"description_dict": {}
|
||||
}
|
||||
}
|
||||
29
config.json
Normal file
29
config.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"_name_or_path": "neuralmagic/Llama-2-7b-pruned70-retrained-ultrachat",
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 11008,
|
||||
"max_position_embeddings": 4096,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 32,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 10000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"tokenizer_class": "LlamaTokenizerFast",
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.40.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 32000
|
||||
}
|
||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
||||
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"transformers_version": "4.40.0"
|
||||
}
|
||||
23
gsm8k_5shot_bs16_bf16.json
Normal file
23
gsm8k_5shot_bs16_bf16.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"results": {
|
||||
"gsm8k": {
|
||||
"acc": 0.047763457164518575,
|
||||
"acc_stderr": 0.005874387536229333
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"gsm8k": 0
|
||||
},
|
||||
"config": {
|
||||
"model": "sparseml",
|
||||
"model_args": "pretrained=/network/alexandre/research/cerebras/llama2_7B_sparse70_retrained/ultrachat200k/llama2_7B_sparse70_LR3e-4_GC2_E2/training,dtype=bfloat16",
|
||||
"num_fewshot": 5,
|
||||
"batch_size": "16",
|
||||
"batch_sizes": [],
|
||||
"device": "cuda:6",
|
||||
"no_cache": true,
|
||||
"limit": null,
|
||||
"bootstrap_iters": 100000,
|
||||
"description_dict": {}
|
||||
}
|
||||
}
|
||||
25
hellaswag_10shot_bs16_bf16.json
Normal file
25
hellaswag_10shot_bs16_bf16.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"results": {
|
||||
"hellaswag": {
|
||||
"acc": 0.5220075682135032,
|
||||
"acc_stderr": 0.004984945635998312,
|
||||
"acc_norm": 0.6885082652857997,
|
||||
"acc_norm_stderr": 0.004621568125102052
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"hellaswag": 0
|
||||
},
|
||||
"config": {
|
||||
"model": "sparseml",
|
||||
"model_args": "pretrained=/network/alexandre/research/cerebras/llama2_7B_sparse70_retrained/ultrachat200k/llama2_7B_sparse70_LR3e-4_GC2_E2/training,dtype=bfloat16",
|
||||
"num_fewshot": 10,
|
||||
"batch_size": "16",
|
||||
"batch_sizes": [],
|
||||
"device": "cuda:3",
|
||||
"no_cache": true,
|
||||
"limit": null,
|
||||
"bootstrap_iters": 100000,
|
||||
"description_dict": {}
|
||||
}
|
||||
}
|
||||
3
mmlu_5shot_bs4_bf16.json
Normal file
3
mmlu_5shot_bs4_bf16.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:394b27758ad95d1194213656be8dec5b8b5222cbfc9a892c81a1cebc7e126793
|
||||
size 14328
|
||||
3
model-00001-of-00003.safetensors
Normal file
3
model-00001-of-00003.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:54edca3c2a8352c32f3ef03e4f7645332bbc1e4caf9b950ee1c10c4fdbff579f
|
||||
size 4938985352
|
||||
3
model-00002-of-00003.safetensors
Normal file
3
model-00002-of-00003.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d9f9ce3f9d7de86e94915298c19be930a279545a20a5086829cec1902a082df
|
||||
size 4947390880
|
||||
3
model-00003-of-00003.safetensors
Normal file
3
model-00003-of-00003.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9e3a9d5769bd1590e828c3fe7a4711687a5cbc67bc3e6e64532d4d9d911becde
|
||||
size 3590488816
|
||||
3
model.safetensors.index.json
Normal file
3
model.safetensors.index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:091fdb60b8ee3713df38fd6f9849c3aa82d7eeeb5f6d224a77139543b1db8652
|
||||
size 23950
|
||||
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
Binary file not shown.
3
tokenizer_config.json
Normal file
3
tokenizer_config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3c83dc4260b41a1c38bb2a26de2ca1f2c7a995aaeea7f1460eda7e0986064d06
|
||||
size 1365
|
||||
25
truthfulqa_mc_0shot_bs16_bf16.json
Normal file
25
truthfulqa_mc_0shot_bs16_bf16.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"results": {
|
||||
"truthfulqa_mc": {
|
||||
"mc1": 0.2521419828641371,
|
||||
"mc1_stderr": 0.01520152224629996,
|
||||
"mc2": 0.3954683484720209,
|
||||
"mc2_stderr": 0.014883378073318826
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"truthfulqa_mc": 1
|
||||
},
|
||||
"config": {
|
||||
"model": "sparseml",
|
||||
"model_args": "pretrained=/network/alexandre/research/cerebras/llama2_7B_sparse70_retrained/ultrachat200k/llama2_7B_sparse70_LR3e-4_GC2_E2/training,dtype=bfloat16",
|
||||
"num_fewshot": 0,
|
||||
"batch_size": "16",
|
||||
"batch_sizes": [],
|
||||
"device": "cuda:4",
|
||||
"no_cache": true,
|
||||
"limit": null,
|
||||
"bootstrap_iters": 100000,
|
||||
"description_dict": {}
|
||||
}
|
||||
}
|
||||
23
winogrande_5shot_bs16_bf16.json
Normal file
23
winogrande_5shot_bs16_bf16.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"results": {
|
||||
"winogrande": {
|
||||
"acc": 0.6511444356748224,
|
||||
"acc_stderr": 0.013395059320137332
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"winogrande": 0
|
||||
},
|
||||
"config": {
|
||||
"model": "sparseml",
|
||||
"model_args": "pretrained=/network/alexandre/research/cerebras/llama2_7B_sparse70_retrained/ultrachat200k/llama2_7B_sparse70_LR3e-4_GC2_E2/training,dtype=bfloat16",
|
||||
"num_fewshot": 5,
|
||||
"batch_size": "16",
|
||||
"batch_sizes": [],
|
||||
"device": "cuda:2",
|
||||
"no_cache": true,
|
||||
"limit": null,
|
||||
"bootstrap_iters": 100000,
|
||||
"description_dict": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user