From e87dea5b395a6a2d1ba1fbae2c42a3acf0e5f29b Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Sat, 27 Jun 2026 01:42:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: RedHatAI/Llama-2-7b-dolphin-open_platypus-pruned_70 Source: Original Platform --- .gitattributes | 35 ++++++++++++++++ README.md | 68 ++++++++++++++++++++++++++++++++ arc_challenge.json | 25 ++++++++++++ config.json | 29 ++++++++++++++ configuration.json | 1 + generation_config.json | 6 +++ gsm8k.json | 23 +++++++++++ hellaswag.json | 25 ++++++++++++ mmlu.json | 3 ++ model-00001-of-00002.safetensors | 3 ++ model-00002-of-00002.safetensors | 3 ++ model.safetensors.index.json | 3 ++ special_tokens_map.json | 23 +++++++++++ tokenizer.json | 3 ++ tokenizer.model | 3 ++ tokenizer_config.json | 41 +++++++++++++++++++ truthfulqa_mc.json | 25 ++++++++++++ winogrande.json | 23 +++++++++++ 18 files changed, 342 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 arc_challenge.json create mode 100644 config.json create mode 100644 configuration.json create mode 100644 generation_config.json create mode 100644 gsm8k.json create mode 100644 hellaswag.json create mode 100644 mmlu.json create mode 100644 model-00001-of-00002.safetensors create mode 100644 model-00002-of-00002.safetensors create mode 100644 model.safetensors.index.json create mode 100644 special_tokens_map.json create mode 100644 tokenizer.json create mode 100644 tokenizer.model create mode 100644 tokenizer_config.json create mode 100644 truthfulqa_mc.json create mode 100644 winogrande.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a6344aa --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..df271d9 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +--- +base_model: neuralmagic/Llama-2-7b-pruned70-retrained +inference: true +model_type: llama +pipeline_tag: text-generation +datasets: + - garage-bAInd/Open-Platypus + - Open-Orca/OpenOrca + - cognitivecomputations/dolphin +tags: +- sparse +- instruct +--- + +# Llama-2-7b-pruned70-retrained-instruct + +This repo contains a [70% sparse Llama 2 7B](https://huggingface.co/neuralmagic/Llama-2-7b-pruned70-retrained) finetuned for instruction-following tasks using a blend of the Platypus + Open Orca + Dolphin datasets. + +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("Llama-2-7b-pruned70-retrained-instruct") +model = AutoModelForCausalLM.from_pretrained("Llama-2-7b-pruned70-retrained-instruct", device_map="auto") + +input_text = "Write a recipe for banana bread:\n" +input_ids = tokenizer(input_text, 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-instruct | Llama-2-7b-pruned70-retrained-instruct | +|------------------------------------------------|---------------|-------------|-------------------------------| +| [MMLU](https://arxiv.org/abs/2009.03300) | 5-shot | 48.60% | 42.33% | +| [HellaSwag](https://arxiv.org/abs/1905.07830) | 10-shot | 79.45% | 77.21% | +| [WinoGrande](https://arxiv.org/abs/1907.10641) | 5-shot | 75.69% | 71.90% | +| [ARC-c](https://arxiv.org/abs/1911.01547) | 25-shot | 53.92% | 47.35% | +| [TruthfulQA](https://arxiv.org/abs/2109.07958) | 0-shot | 43.63% | 42.25% | +| [GSM8K](https://arxiv.org/abs/2110.14168) | 5-shot | 15.92% | 14.25% | + +## Model Training Details + +This model was obtained by sparse-tranfer of the sparse foundational model [Llama-2-7b-pruned50-retrained](https://huggingface.co/neuralmagic/Llama-2-7b-pruned70-retrained) on a blend of [Open Platypus](https://huggingface.co/datasets/garage-bAInd/Open-Platypus), 10% [Open Orca](https://huggingface.co/datasets/Open-Orca/OpenOrca) and 10% [Dolphin](https://huggingface.co/datasets/cognitivecomputations/dolphin) datasets. Training was perfomerd for 6 epochs. + +## 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) \ No newline at end of file diff --git a/arc_challenge.json b/arc_challenge.json new file mode 100644 index 0000000..95cc84d --- /dev/null +++ b/arc_challenge.json @@ -0,0 +1,25 @@ +{ + "results": { + "arc_challenge": { + "acc": 0.4803754266211604, + "acc_stderr": 0.014600132075947094, + "acc_norm": 0.5025597269624573, + "acc_norm_stderr": 0.014611199329843784 + } + }, + "versions": { + "arc_challenge": 0 + }, + "config": { + "model": "hf", + "model_args": "pretrained=/nm/drive1/shubhra/cerebras/experiments/spft-cerebras_llama2_sparse50_45B_platypus_dolphin_KDFalse_GCTrue_LR1e-4_E2/combined/,trust_remote_code=True,dtype=bfloat16", + "num_fewshot": 25, + "batch_size": "32", + "batch_sizes": [], + "device": "cuda:0", + "no_cache": true, + "limit": null, + "bootstrap_iters": 100000, + "description_dict": {} + } +} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..e8b2654 --- /dev/null +++ b/config.json @@ -0,0 +1,29 @@ +{ + "_name_or_path": "neuralmagic/Llama-2-7b-pruned70-retrained-instruct", + "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": "1.7.0.43401", + "use_cache": true, + "vocab_size": 32000 +} diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..bbeeda1 --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-generation", "allow_remote": true} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..b9f5b6d --- /dev/null +++ b/generation_config.json @@ -0,0 +1,6 @@ +{ + "_from_model_config": true, + "bos_token_id": 1, + "eos_token_id": 2, + "transformers_version": "1.7.0.43401" +} diff --git a/gsm8k.json b/gsm8k.json new file mode 100644 index 0000000..6239f3b --- /dev/null +++ b/gsm8k.json @@ -0,0 +1,23 @@ +{ + "results": { + "gsm8k": { + "acc": 0.18119787717968158, + "acc_stderr": 0.010609827611527357 + } + }, + "versions": { + "gsm8k": 0 + }, + "config": { + "model": "hf", + "model_args": "pretrained=/nm/drive1/shubhra/cerebras/experiments/spft-cerebras_llama2_sparse50_45B_platypus_dolphin_KDFalse_GCTrue_LR1e-4_E2/combined/,trust_remote_code=True,dtype=bfloat16", + "num_fewshot": 5, + "batch_size": "128", + "batch_sizes": [], + "device": "cuda:0", + "no_cache": true, + "limit": null, + "bootstrap_iters": 100000, + "description_dict": {} + } +} \ No newline at end of file diff --git a/hellaswag.json b/hellaswag.json new file mode 100644 index 0000000..ed18f08 --- /dev/null +++ b/hellaswag.json @@ -0,0 +1,25 @@ +{ + "results": { + "hellaswag": { + "acc": 0.5884285998805019, + "acc_stderr": 0.004911125101064641, + "acc_norm": 0.784106751643099, + "acc_norm_stderr": 0.004105997149954853 + } + }, + "versions": { + "hellaswag": 0 + }, + "config": { + "model": "hf", + "model_args": "pretrained=/nm/drive1/shubhra/cerebras/experiments/spft-cerebras_llama2_sparse50_45B_platypus_dolphin_KDFalse_GCTrue_LR1e-4_E2/combined/,trust_remote_code=True,dtype=bfloat16", + "num_fewshot": 10, + "batch_size": "48", + "batch_sizes": [], + "device": "cuda:0", + "no_cache": true, + "limit": null, + "bootstrap_iters": 100000, + "description_dict": {} + } +} \ No newline at end of file diff --git a/mmlu.json b/mmlu.json new file mode 100644 index 0000000..3ec0a4c --- /dev/null +++ b/mmlu.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79081a09fdf963d94f6f2d8c298c881cce9c960dff18d5445d75010797b31d9f +size 14284 diff --git a/model-00001-of-00002.safetensors b/model-00001-of-00002.safetensors new file mode 100644 index 0000000..4a36b7a --- /dev/null +++ b/model-00001-of-00002.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73199b4063a3f4be2036cf071a933f467efe61d8f03cb275d49d7c4b368d305f +size 9976570520 diff --git a/model-00002-of-00002.safetensors b/model-00002-of-00002.safetensors new file mode 100644 index 0000000..cc3123f --- /dev/null +++ b/model-00002-of-00002.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9544c229cb5f32b0ed0b14e11f0db472cc84ce95207551476621337009861ceb +size 3500294544 diff --git a/model.safetensors.index.json b/model.safetensors.index.json new file mode 100644 index 0000000..02c356f --- /dev/null +++ b/model.safetensors.index.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:610194b49eade5f9d8ff8702c373fdd515269847f6d36425355ed1c2fd31f348 +size 23950 diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..451134b --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,23 @@ +{ + "bos_token": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "eos_token": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "unk_token": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + } +} diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..21779d6 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcd04f0eadf90287bd26e1a183ac487d8a141b09b06aecb7725bbdd343640f2e +size 1842767 diff --git a/tokenizer.model b/tokenizer.model new file mode 100644 index 0000000..6c00c74 --- /dev/null +++ b/tokenizer.model @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347 +size 499723 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..120fe80 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,41 @@ +{ + "add_bos_token": true, + "add_eos_token": false, + "added_tokens_decoder": { + "0": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "1": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "2": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + } + }, + "bos_token": "", + "clean_up_tokenization_spaces": false, + "eos_token": "", + "legacy": false, + "model_max_length": 1000000000000000019884624838656, + "pad_token": null, + "padding_side": "right", + "sp_model_kwargs": {}, + "tokenizer_class": "LlamaTokenizer", + "unk_token": "", + "use_default_system_prompt": false +} diff --git a/truthfulqa_mc.json b/truthfulqa_mc.json new file mode 100644 index 0000000..dc51f59 --- /dev/null +++ b/truthfulqa_mc.json @@ -0,0 +1,25 @@ +{ + "results": { + "truthfulqa_mc": { + "mc1": 0.2839657282741738, + "mc1_stderr": 0.015785370858396725, + "mc2": 0.4316910007581044, + "mc2_stderr": 0.014766457929501058 + } + }, + "versions": { + "truthfulqa_mc": 1 + }, + "config": { + "model": "hf", + "model_args": "pretrained=/nm/drive1/shubhra/cerebras/experiments/spft-cerebras_llama2_sparse50_45B_platypus_dolphin_KDFalse_GCTrue_LR1e-4_E2/combined/,trust_remote_code=True,dtype=bfloat16", + "num_fewshot": 0, + "batch_size": "128", + "batch_sizes": [], + "device": "cuda:0", + "no_cache": true, + "limit": null, + "bootstrap_iters": 100000, + "description_dict": {} + } +} \ No newline at end of file diff --git a/winogrande.json b/winogrande.json new file mode 100644 index 0000000..e04ac43 --- /dev/null +++ b/winogrande.json @@ -0,0 +1,23 @@ +{ + "results": { + "winogrande": { + "acc": 0.7324388318863457, + "acc_stderr": 0.012441718456893009 + } + }, + "versions": { + "winogrande": 0 + }, + "config": { + "model": "hf", + "model_args": "pretrained=/nm/drive1/shubhra/cerebras/experiments/spft-cerebras_llama2_sparse50_45B_platypus_dolphin_KDFalse_GCTrue_LR1e-4_E2/combined/,trust_remote_code=True,dtype=bfloat16", + "num_fewshot": 5, + "batch_size": "128", + "batch_sizes": [], + "device": "cuda:0", + "no_cache": true, + "limit": null, + "bootstrap_iters": 100000, + "description_dict": {} + } +} \ No newline at end of file