初始化项目,由ModelHub XC社区提供模型
Model: OPEA/Falcon3-10B-Base-int4-sym-inc 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
|
||||||
166
README.md
Normal file
166
README.md
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
---
|
||||||
|
datasets:
|
||||||
|
- NeelNanda/pile-10k
|
||||||
|
base_model:
|
||||||
|
- tiiuae/Falcon3-10B-Base
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
This model is an int4 model with group_size 128 and symmetric quantization of [tiiuae/Falcon3-10B-Base](https://huggingface.co/tiiuae/Falcon3-10B-Base) generated by [intel/auto-round](https://github.com/intel/auto-round). Load the model with revision `4579272` to use AutoGPTQ format
|
||||||
|
|
||||||
|
## How To Use
|
||||||
|
|
||||||
|
### INT4 Inference(CPU/HPU/CUDA)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from auto_round import AutoRoundConfig ##must import for auto_round format
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
quantized_model_dir = "OPEA/Falcon3-10B-Base-int4-sym-inc"
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
quantized_model_dir,
|
||||||
|
device_map="auto"
|
||||||
|
## revision="4579272" ##AutoGPTQ format
|
||||||
|
)
|
||||||
|
text = "How many r in strawberry? The answer is "
|
||||||
|
inputs = tokenizer(text, return_tensors="pt", return_token_type_ids=False).to(model.device)
|
||||||
|
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))
|
||||||
|
|
||||||
|
text = "How many r in strawberry? The answer is"
|
||||||
|
##INT4:
|
||||||
|
"""How many r in strawberry? The answer is 2.
|
||||||
|
|
||||||
|
### Additional Questions and Answers
|
||||||
|
|
||||||
|
#### 11. **How many r in strawberry?**
|
||||||
|
**Answer:**
|
||||||
|
The word "strawberry" contains 2 'r's.
|
||||||
|
|
||||||
|
####
|
||||||
|
"""
|
||||||
|
|
||||||
|
##BF16:
|
||||||
|
"""
|
||||||
|
How many r in strawberry? The ansnwer is 2.
|
||||||
|
|
||||||
|
### 10. **How many r in strawberry?**
|
||||||
|
**Question:** How many times does the letter 'r' appear in the word "strawberry"?
|
||||||
|
**Answer:** The letter 'r
|
||||||
|
|
||||||
|
**Answer:**
|
||||||
|
The answer to the riddle"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
text = "Which number is larger, 9.8 or 9.11? The answer is"
|
||||||
|
##INT4
|
||||||
|
"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
|
||||||
|
|
||||||
|
#### 10. **What is the smallest number in the set {1.2, 1.02, 1.22, 1.002}?**
|
||||||
|
"""
|
||||||
|
##BF16:
|
||||||
|
"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
|
||||||
|
|
||||||
|
#### Question 2:
|
||||||
|
**How do you compare the numbers 12.34 and 12.345?**
|
||||||
|
|
||||||
|
**Answer:**
|
||||||
|
To compare 12.34"""
|
||||||
|
|
||||||
|
|
||||||
|
text = "Once upon a time,"
|
||||||
|
##INT4:
|
||||||
|
"""Once upon a time, in a small town named Harmonyville, lived two best friends - Mia and Ben. They were both eight years old and loved exploring the world around them. One sunny afternoon, while playing near the park, they found a mysterious box with a note
|
||||||
|
"""
|
||||||
|
|
||||||
|
##BF16:
|
||||||
|
"""Once upon a time, in a small town named Harmonyville, there lived two best friends - Timmy the Turtle and Sally the Squirrel. They loved exploring their beautiful forest home together, discovering new things every day. One sunny afternoon, they stumbled upon a mysterious cave filled with
|
||||||
|
"""
|
||||||
|
|
||||||
|
text = "There is a girl who likes adventure,"
|
||||||
|
##INT4:
|
||||||
|
"""There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a faraway land called "The Land of the Sun." She packed her bag with everything she needed, including her favorite book about the sun.
|
||||||
|
"""
|
||||||
|
|
||||||
|
##BF16:
|
||||||
|
"""There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a beautiful country called Italy. She wanted to see all the famous landmarks and try the delicious Italian food.
|
||||||
|
"""
|
||||||
|
```
|
||||||
|
|
||||||
|
### Evaluate the model
|
||||||
|
|
||||||
|
pip3 install lm-eval==0.4.5
|
||||||
|
|
||||||
|
```bash
|
||||||
|
auto-round --model "OPEA/Falcon3-10B-Base-int4-sym-inc" --eval --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| Metric | BF16 | INT4 |
|
||||||
|
| ------------------------- | ----------------- | ----------------- |
|
||||||
|
| Avg.13 | 0.6151 | 0.6092 |
|
||||||
|
| Avg.10 | 0.64113 | 0.63584 |
|
||||||
|
| leaderboard_mmlu_pro | 0.4238 | 0.4156 |
|
||||||
|
| leaderboard_ifeval | (0.4149+0.2939)/2 | (0.4233+0.2828)/2 |
|
||||||
|
| gsm8k(5shot) strict match | 0.8067 | 0.7923 |
|
||||||
|
| mmlu | 0.7069 | 0.6930 |
|
||||||
|
| lambada_openai | 0.6998 | 0.7025 |
|
||||||
|
| hellaswag | 0.5873 | 0.5832 |
|
||||||
|
| winogrande | 0.7380 | 0.7293 |
|
||||||
|
| piqa | 0.7884 | 0.7889 |
|
||||||
|
| truthfulqa_mc1 | 0.3427 | 0.3452 |
|
||||||
|
| openbookqa | 0.3400 | 0.3320 |
|
||||||
|
| boolq | 0.8232 | 0.8116 |
|
||||||
|
| arc_easy | 0.8312 | 0.8258 |
|
||||||
|
| arc_challenge | 0.5538 | 0.5469 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Generate the model
|
||||||
|
|
||||||
|
Here is the sample command to generate the model.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
auto-round \
|
||||||
|
--model tiiuae/Falcon3-10B-Base \
|
||||||
|
--device 0 \
|
||||||
|
--group_size 128 \
|
||||||
|
--nsamples 512 \
|
||||||
|
--bits 4 \
|
||||||
|
--iter 1000 \
|
||||||
|
--disable_eval \
|
||||||
|
--model_dtype 'float16' \
|
||||||
|
--format 'auto_gptq,auto_round' \
|
||||||
|
--output_dir "./tmp_autoround"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ethical Considerations and Limitations
|
||||||
|
|
||||||
|
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
|
||||||
|
|
||||||
|
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
||||||
|
|
||||||
|
## Caveats and Recommendations
|
||||||
|
|
||||||
|
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
||||||
|
|
||||||
|
Here are a couple of useful links to learn more about Intel's AI software:
|
||||||
|
|
||||||
|
- Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
|
||||||
|
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
|
||||||
|
|
||||||
|
## Cite
|
||||||
|
|
||||||
|
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
|
||||||
|
|
||||||
|
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
|
||||||
52
config.json
Normal file
52
config.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "/models/falcon-three-10b",
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 11,
|
||||||
|
"head_dim": 256,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 3072,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 23040,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 12,
|
||||||
|
"num_hidden_layers": 40,
|
||||||
|
"num_key_value_heads": 4,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"quantization_config": {
|
||||||
|
"amp": true,
|
||||||
|
"autoround_version": "0.4.2",
|
||||||
|
"batch_size": 8,
|
||||||
|
"bits": 4,
|
||||||
|
"data_type": "int",
|
||||||
|
"dataset": "NeelNanda/pile-10k",
|
||||||
|
"enable_minmax_tuning": true,
|
||||||
|
"enable_norm_bias_tuning": false,
|
||||||
|
"enable_quanted_input": true,
|
||||||
|
"gradient_accumulate_steps": 1,
|
||||||
|
"group_size": 128,
|
||||||
|
"iters": 1000,
|
||||||
|
"low_gpu_mem_usage": false,
|
||||||
|
"lr": 0.001,
|
||||||
|
"minmax_lr": 0.001,
|
||||||
|
"nsamples": 512,
|
||||||
|
"quant_method": "auto-round",
|
||||||
|
"scale_dtype": "torch.float16",
|
||||||
|
"seqlen": 2048,
|
||||||
|
"sym": true
|
||||||
|
},
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"rope_theta": 1000042,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"torch_dtype": "float16",
|
||||||
|
"transformers_version": "4.47.0",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 131072
|
||||||
|
}
|
||||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 11,
|
||||||
|
"eos_token_id": 11,
|
||||||
|
"transformers_version": "4.47.0"
|
||||||
|
}
|
||||||
3
model-00001-of-00002.safetensors
Normal file
3
model-00001-of-00002.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:00c2f049aa4179d5ed9a192532d226084e419a1f55f0b040c682c9bd1dc8366c
|
||||||
|
size 4969860688
|
||||||
3
model-00002-of-00002.safetensors
Normal file
3
model-00002-of-00002.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ce35cc9e9bf5b392d775c54ef08378661d90fc8e705492cce513b82f05c21b4b
|
||||||
|
size 1583618568
|
||||||
1210
model.safetensors.index.json
Normal file
1210
model.safetensors.index.json
Normal file
File diff suppressed because it is too large
Load Diff
23
quantization_config.json
Normal file
23
quantization_config.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"bits": 4,
|
||||||
|
"group_size": 128,
|
||||||
|
"sym": true,
|
||||||
|
"data_type": "int",
|
||||||
|
"enable_quanted_input": true,
|
||||||
|
"enable_minmax_tuning": true,
|
||||||
|
"seqlen": 2048,
|
||||||
|
"batch_size": 8,
|
||||||
|
"scale_dtype": "torch.float16",
|
||||||
|
"lr": 0.001,
|
||||||
|
"minmax_lr": 0.001,
|
||||||
|
"gradient_accumulate_steps": 1,
|
||||||
|
"iters": 1000,
|
||||||
|
"amp": true,
|
||||||
|
"nsamples": 512,
|
||||||
|
"low_gpu_mem_usage": false,
|
||||||
|
"to_quant_block_names": null,
|
||||||
|
"enable_norm_bias_tuning": false,
|
||||||
|
"dataset": "NeelNanda/pile-10k",
|
||||||
|
"autoround_version": "0.4.2",
|
||||||
|
"quant_method": "auto-round"
|
||||||
|
}
|
||||||
41
special_tokens_map.json
Normal file
41
special_tokens_map.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
">>TITLE<<",
|
||||||
|
">>ABSTRACT<<",
|
||||||
|
">>INTRODUCTION<<",
|
||||||
|
">>SUMMARY<<",
|
||||||
|
">>COMMENT<<",
|
||||||
|
">>ANSWER<<",
|
||||||
|
">>QUESTION<<",
|
||||||
|
">>DOMAIN<<",
|
||||||
|
">>EMAIL_ADDRESS<<",
|
||||||
|
">>IP_ADDRESS<<",
|
||||||
|
"<|startoftext|>",
|
||||||
|
">>IP_ADDRESS_0<<",
|
||||||
|
">>IP_ADDRESS_1<<",
|
||||||
|
">>IP_ADDRESS_2<<",
|
||||||
|
">>IP_ADDRESS_3<<",
|
||||||
|
">>IP_ADDRESS_4<<",
|
||||||
|
">>IP_ADDRESS_5<<",
|
||||||
|
">>IP_ADDRESS_6<<",
|
||||||
|
">>IP_ADDRESS_7<<",
|
||||||
|
">>IP_ADDRESS_8<<",
|
||||||
|
">>IP_ADDRESS_9<<",
|
||||||
|
">>PASSWORD<<",
|
||||||
|
">>KEY<<"
|
||||||
|
],
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
664581
tokenizer.json
Normal file
664581
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
16228
tokenizer_config.json
Normal file
16228
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user