初始化项目,由ModelHub XC社区提供模型
Model: dystrio/Llama-3.1-8B-Instruct-sculpt-default Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
*.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
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
150
README.md
Normal file
150
README.md
Normal file
@@ -0,0 +1,150 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
language:
|
||||
- en
|
||||
base_model: meta-llama/Llama-3.1-8B-Instruct
|
||||
tags:
|
||||
- dystrio
|
||||
- sculpt
|
||||
- pruned
|
||||
- compressed
|
||||
- efficient
|
||||
- dense
|
||||
- runtime-agnostic
|
||||
- no-custom-kernels
|
||||
- hf-drop-in
|
||||
- drop-in-replacement
|
||||
- smaller
|
||||
- faster
|
||||
- llama
|
||||
datasets:
|
||||
- wikitext
|
||||
model-index:
|
||||
- name: Dystrio Sculpt (Llama-3.1-8B-Instruct Default)
|
||||
results:
|
||||
- task:
|
||||
type: text-generation
|
||||
dataset:
|
||||
name: WikiText-103 (validation)
|
||||
type: wikitext
|
||||
metrics:
|
||||
- name: perplexity
|
||||
type: perplexity
|
||||
value: 14.7778
|
||||
- name: ppl_ratio
|
||||
type: ppl_ratio
|
||||
value: 1.0641
|
||||
---
|
||||
|
||||
# dystrio/Llama-3.1-8B-Instruct-sculpt-default
|
||||
|
||||
> **10% smaller, quality preserved (1.0641x PPL), drop-in replacement. No custom kernels. No runtime changes.**
|
||||
|
||||
Dystrio Sculpt structurally compresses transformer models, producing dense models that load with standard `transformers` — no custom code, no new ops, no deployment friction.
|
||||
|
||||
This is the **Default** tier of [Llama 3.1 8B Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct).
|
||||
|
||||
## Quick Start
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained("dystrio/Llama-3.1-8B-Instruct-sculpt-default", torch_dtype="bfloat16", device_map="auto")
|
||||
tokenizer = AutoTokenizer.from_pretrained("dystrio/Llama-3.1-8B-Instruct-sculpt-default")
|
||||
|
||||
inputs = tokenizer("The future of AI inference is", return_tensors="pt").to(model.device)
|
||||
outputs = model.generate(**inputs, max_new_tokens=100)
|
||||
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
||||
```
|
||||
|
||||
## Benchmark Results
|
||||
|
||||
All tiers compiled from [Llama 3.1 8B Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) on A100 80GB, bf16:
|
||||
|
||||
| Model | PPL | PPL Ratio | Weights (GB) | Chat Prefill TPS | RAG TTFT p95 (ms) | Decode TPS |
|
||||
|-------|-----|-----------|-------------|------------------|-------------------|------------|
|
||||
| **Baseline** | 13.8879 | 1.0 | 14.957527 | 10570.4 | 126.745 | 66.8 |
|
||||
| **sculpt-default** | 14.7778 | 1.0641 | 13.457527 | 11418.6 | 116.957 | 65.5 |
|
||||
| **sculpt-production** | 21.9236 | 1.5786 | 11.863777 | 12760.5 | 112.529 | 66.7 |
|
||||
| **sculpt-throughput** | 27.7463 | 1.9979 | 11.020027 | 13408.6 | 104.086 | 67.5 |
|
||||
| **sculpt-experimental** | 29.3853 | 2.1159 | 10.832527 | 13483.3 | 103.432 | 67.4 |
|
||||
|
||||
### Key Metrics (this model)
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| **Weights memory** | 13.457527 GB (10% smaller) |
|
||||
| **PPL ratio** | 1.0641 |
|
||||
| **Chat prefill TPS** | 11418.6 (+8%) |
|
||||
| **RAG TTFT p95** | 116.957 ms (-8%) |
|
||||
| **Decode TPS** | 65.5 (flat) |
|
||||
| **Parameters** | 7.22B |
|
||||
|
||||
## All Sculpt Tiers
|
||||
|
||||
| Tier | HuggingFace | Size | PPL Ratio | Use Case |
|
||||
|------|-------------|------|-----------|----------|
|
||||
| default | [dystrio/Llama-3.1-8B-Instruct-sculpt-default](https://huggingface.co/dystrio/Llama-3.1-8B-Instruct-sculpt-default) 👈 **this model** | 13.457527 GB | 1.0641 | Zero-regret: quality preserved, smaller footprint |
|
||||
| production | [dystrio/Llama-3.1-8B-Instruct-sculpt-production](https://huggingface.co/dystrio/Llama-3.1-8B-Instruct-sculpt-production) | 11.863777 GB | 1.5786 | Practical savings with modest quality tradeoff |
|
||||
| throughput | [dystrio/Llama-3.1-8B-Instruct-sculpt-throughput](https://huggingface.co/dystrio/Llama-3.1-8B-Instruct-sculpt-throughput) | 11.020027 GB | 1.9979 | Maximum usable compression for speed/edge |
|
||||
| experimental | [dystrio/Llama-3.1-8B-Instruct-sculpt-experimental](https://huggingface.co/dystrio/Llama-3.1-8B-Instruct-sculpt-experimental) | 10.832527 GB | 2.1159 | Boundary exploration, maximum structural compression |
|
||||
|
||||
## What is Dystrio Sculpt?
|
||||
|
||||
Dystrio Sculpt compiles transformer models into smaller, faster variants. Output models:
|
||||
|
||||
- Are **dense** (not sparse) — standard architecture, fewer parameters
|
||||
- Load with **standard HuggingFace Transformers** — no custom code needed
|
||||
- Require **no custom kernels** and **no runtime changes**
|
||||
- Work as a one-step compile before deployment
|
||||
- Stack with quantization (AWQ, GPTQ, GGUF) for compound savings
|
||||
|
||||
## Compatibility
|
||||
|
||||
- ✅ HuggingFace Transformers
|
||||
- ✅ vLLM
|
||||
- ✅ TGI (Text Generation Inference)
|
||||
- ✅ llama.cpp / GGUF conversion
|
||||
- ✅ AWQ / GPTQ quantization
|
||||
- ✅ Any framework that loads standard safetensors
|
||||
|
||||
## Benchmark Environment
|
||||
|
||||
- **GPU**: NVIDIA A100-SXM4-80GB
|
||||
- **dtype**: bf16
|
||||
- **Torch**: 2.10.0+cu128
|
||||
- **Transformers**: 5.3.0
|
||||
- **Deterministic**: True
|
||||
- Single-GPU, standard HuggingFace Transformers, no custom kernels.
|
||||
|
||||
## Metric Definitions
|
||||
|
||||
- **PPL ratio**: WikiText-103 perplexity relative to baseline. <1.0 = quality improved.
|
||||
- **Prefill TPS**: Tokens per second during prompt encoding (higher = faster).
|
||||
- **TTFT p95**: Time to first token at 95th percentile (lower = faster).
|
||||
- **Decode TPS**: Tokens per second during generation (higher = faster).
|
||||
- **Weights (GB)**: Model parameter memory (deterministic, runtime-independent).
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@misc{dystrio_sculpt_2026,
|
||||
title={Dystrio Sculpt: Structural Compilation for Transformer LLMs},
|
||||
author={Dystrio},
|
||||
year={2026},
|
||||
url={https://huggingface.co/dystrio}
|
||||
}
|
||||
```
|
||||
|
||||
## Downstream Benchmarks (lm-eval)
|
||||
|
||||
Evaluated with [lm-eval-harness](https://github.com/EleutherAI/lm-evaluation-harness) on A100-80GB, bf16, zero-shot.
|
||||
|
||||
| Benchmark | Baseline | This Model | Delta |
|
||||
|-----------|:--------:|:----------:|:-----:|
|
||||
| ARC-Challenge | 0.5358 | 0.4283 | -0.1075 |
|
||||
| HellaSwag | 0.5977 | 0.5416 | -0.0561 |
|
||||
| MMLU | 0.6844 | 0.5590 | -0.1254 |
|
||||
| TruthfulQA MC2 | 0.5456 | 0.4824 | -0.0632 |
|
||||
109
chat_template.jinja
Normal file
109
chat_template.jinja
Normal file
@@ -0,0 +1,109 @@
|
||||
{{- bos_token }}
|
||||
{%- if custom_tools is defined %}
|
||||
{%- set tools = custom_tools %}
|
||||
{%- endif %}
|
||||
{%- if not tools_in_user_message is defined %}
|
||||
{%- set tools_in_user_message = true %}
|
||||
{%- endif %}
|
||||
{%- if not date_string is defined %}
|
||||
{%- set date_string = "26 Jul 2024" %}
|
||||
{%- endif %}
|
||||
{%- if not tools is defined %}
|
||||
{%- set tools = none %}
|
||||
{%- endif %}
|
||||
|
||||
{#- This block extracts the system message, so we can slot it into the right place. #}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{%- set system_message = messages[0]['content']|trim %}
|
||||
{%- set messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{%- set system_message = "" %}
|
||||
{%- endif %}
|
||||
|
||||
{#- System message + builtin tools #}
|
||||
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
|
||||
{%- if builtin_tools is defined or tools is not none %}
|
||||
{{- "Environment: ipython\n" }}
|
||||
{%- endif %}
|
||||
{%- if builtin_tools is defined %}
|
||||
{{- "Tools: " + builtin_tools | reject('equalto', 'code_interpreter') | join(", ") + "\n\n"}}
|
||||
{%- endif %}
|
||||
{{- "Cutting Knowledge Date: December 2023\n" }}
|
||||
{{- "Today Date: " + date_string + "\n\n" }}
|
||||
{%- if tools is not none and not tools_in_user_message %}
|
||||
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
|
||||
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||
{{- "Do not use variables.\n\n" }}
|
||||
{%- for t in tools %}
|
||||
{{- t | tojson(indent=4) }}
|
||||
{{- "\n\n" }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- system_message }}
|
||||
{{- "<|eot_id|>" }}
|
||||
|
||||
{#- Custom tools are passed in a user message with some extra guidance #}
|
||||
{%- if tools_in_user_message and not tools is none %}
|
||||
{#- Extract the first user message so we can plug it in here #}
|
||||
{%- if messages | length != 0 %}
|
||||
{%- set first_user_message = messages[0]['content']|trim %}
|
||||
{%- set messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
|
||||
{%- endif %}
|
||||
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
|
||||
{{- "Given the following functions, please respond with a JSON for a function call " }}
|
||||
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
|
||||
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||
{{- "Do not use variables.\n\n" }}
|
||||
{%- for t in tools %}
|
||||
{{- t | tojson(indent=4) }}
|
||||
{{- "\n\n" }}
|
||||
{%- endfor %}
|
||||
{{- first_user_message + "<|eot_id|>"}}
|
||||
{%- endif %}
|
||||
|
||||
{%- for message in messages %}
|
||||
{%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
|
||||
{{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
|
||||
{%- elif 'tool_calls' in message %}
|
||||
{%- if not message.tool_calls|length == 1 %}
|
||||
{{- raise_exception("This model only supports single tool-calls at once!") }}
|
||||
{%- endif %}
|
||||
{%- set tool_call = message.tool_calls[0].function %}
|
||||
{%- if builtin_tools is defined and tool_call.name in builtin_tools %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
|
||||
{{- "<|python_tag|>" + tool_call.name + ".call(" }}
|
||||
{%- for arg_name, arg_val in tool_call.arguments | items %}
|
||||
{{- arg_name + '="' + arg_val + '"' }}
|
||||
{%- if not loop.last %}
|
||||
{{- ", " }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- ")" }}
|
||||
{%- else %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
|
||||
{{- '{"name": "' + tool_call.name + '", ' }}
|
||||
{{- '"parameters": ' }}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{{- "}" }}
|
||||
{%- endif %}
|
||||
{%- if builtin_tools is defined %}
|
||||
{#- This means we're in ipython mode #}
|
||||
{{- "<|eom_id|>" }}
|
||||
{%- else %}
|
||||
{{- "<|eot_id|>" }}
|
||||
{%- endif %}
|
||||
{%- elif message.role == "tool" or message.role == "ipython" %}
|
||||
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
|
||||
{%- if message.content is mapping or message.content is iterable %}
|
||||
{{- message.content | tojson }}
|
||||
{%- else %}
|
||||
{{- message.content }}
|
||||
{%- endif %}
|
||||
{{- "<|eot_id|>" }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
|
||||
{%- endif %}
|
||||
40
config.json
Normal file
40
config.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"dtype": "bfloat16",
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 12288,
|
||||
"max_position_embeddings": 131072,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": null,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_parameters": {
|
||||
"factor": 8.0,
|
||||
"high_freq_factor": 4.0,
|
||||
"low_freq_factor": 1.0,
|
||||
"original_max_position_embeddings": 8192,
|
||||
"rope_theta": 500000.0,
|
||||
"rope_type": "llama3"
|
||||
},
|
||||
"tie_word_embeddings": false,
|
||||
"transformers_version": "5.3.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128256
|
||||
}
|
||||
12
generation_config.json
Normal file
12
generation_config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"bos_token_id": 128000,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"temperature": 0.6,
|
||||
"top_p": 0.9,
|
||||
"transformers_version": "5.3.0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:194b3be05822ec65d44921b6b3884d000d5629ec397130324108458e62be3c37
|
||||
size 14449943840
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:13574c77ca1d572525cfa7caac46cee99309100524dad568a7ef85ae383df39f
|
||||
size 17210018
|
||||
14
tokenizer_config.json
Normal file
14
tokenizer_config.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"backend": "tokenizers",
|
||||
"bos_token": "<|begin_of_text|>",
|
||||
"clean_up_tokenization_spaces": true,
|
||||
"eos_token": "<|eot_id|>",
|
||||
"is_local": false,
|
||||
"model_input_names": [
|
||||
"input_ids",
|
||||
"attention_mask"
|
||||
],
|
||||
"model_max_length": 131072,
|
||||
"pad_token": "<|eot_id|>",
|
||||
"tokenizer_class": "TokenizersBackend"
|
||||
}
|
||||
Reference in New Issue
Block a user