Model Details

This model is an int4 model with group_size 128 and and symmetric quantization of deepseek-ai/DeepSeek-V2.5-1210 generated by intel/auto-round algorithm. Load the model with revision="6d3d2cf" to use AutoGPTQ format. Please note that loading the model in Transformers can be quite slow. Consider using an alternative serving framework for better performance. For other serving frameworks, the autogptq format is required. You can run the following command to fetch the model:

git clone https://huggingface.co/OPEA/DeepSeek-V2.5-1210-int4-sym-inc && cd DeepSeek-V2.5-1210-int4-sym-inc && git checkout 6d3d2cf

Please follow the license of the origin model.

How To Use

INT4 Inference(CPU/CUDA)

from auto_round import AutoRoundConfig ##must import for auto-round format
from transformers import AutoModelForCausalLM, AutoTokenizer,GenerationConfig
import torch
quantized_model_dir="OPEA/DeepSeek-V2.5-1210-int4-sym-inc"
max_memory = {i: "75GB" for i in range(2)}

model = AutoModelForCausalLM.from_pretrained(
    quantized_model_dir,
    torch_dtype=torch.float16,
    device_map="sequential",
    attn_implementation="eager",
    trust_remote_code=True,
    max_memory=max_memory,
    ##revision="6d3d2cf" ##AutoGPTQ format

)
model.generation_config = GenerationConfig.from_pretrained(model_name)
model.generation_config.pad_token_id = model.generation_config.eos_token_id

tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir,trust_remote_code=True)
prompt = "There is a girl who likes adventure,"
messages = [
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

generated_ids = model.generate(
    model_inputs.input_ids,
    max_new_tokens=512,  ##change this to align with the official usage
    do_sample=False  ##change this to align with the official usage
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)



prompt = "strawberry中有几个r?"
##INT4
"""### 第一步:理解问题

首先,我需要明确问题的含义。问题是:“strawberry中有几个r?” 这里的“strawberry”指的是一种水果,而“r”则是英文字母。问题实际上是在问,单词“strawberry”中包含了多少个字母“r”。

### 第二步:分析单词结构

为了回答这个问题,我需要仔细分析单词“strawberry”的结构,找出其中所有的字母“r”。

单词“strawberry”拼写如下:

```
s t r a w b e r r y
```

### 第三步:逐个字母检查

接下来,我将逐个字母检查,看看哪些字母是“r”。

1. **s** - 不是“r”
2. **t** - 不是“r”
3. **r** - 是“r”
4. **a** - 不是“r”
5. **w** - 不是“r”
6. **b** - 不是“r”
7. **e** - 不是“r”
8. **r** - 是“r”
9. **r** - 是“r”
10. **y** - 不是“r”

### 第四步:统计“r”的数量

通过上述检查,我发现单词“strawberry”中共有三个字母“r”。

### 第五步:验证结果

为了确保我的答案正确,我再次检查了单词的拼写,并重新数了一遍“r”的数量,确认确实有三个“r”。

### 最终答案

综上所述,单词“strawberry”中共有**三个**字母“r”。"""


prompt = "9.11和9.8哪个数字大"  

##INT4
"""要比较 **9.11** 和 **9.8** 的大小,可以按照以下步骤进行:

1. **比较整数部分**:
   - 两个数的整数部分都是 **9**,因此需要比较小数部分。

2. **比较小数部分**:
   - **9.11** 的小数部分是 **0.11**
   - **9.8** 的小数部分是 **0.8**

3. **比较小数部分的大小**:
   - **0.8** 大于 **0.11**

4. **得出结论**:
   - 由于小数部分 **0.8** 大于 **0.11**,所以 **9.8** 大于 **9.11**。

最终答案是:

\[
\boxed{9.8}
\]"""


prompt = "Please give a brief introduction of DeepSeek company."
##INT4:"""DeepSeek Artificial Intelligence Co., Ltd. (referred to as "DeepSeek" or "深度求索") , founded in 2023, is a Chinese company dedicated to making AGI a reality."""

prompt = "There is a girl who likes adventure,"
##INT4:
"""It sounds like you're setting the stage for a story or a character introduction! Here's a little continuation to spark your imagination:

---

There is a girl who likes adventure. Her name is Lily, and her eyes sparkle with curiosity whenever she hears the word "explore." Whether it's hiking through dense forests, diving into the mysteries of the ocean, or wandering through bustling city streets in search of hidden treasures, Lily is always ready for the next thrill.

Her backpack is never without a map, a compass, and a notebook where she scribbles down her discoveries. She believes that every adventure, no matter how small, holds a story waiting to be told. Her friends often joke that she has a sixth sense for finding the most exciting paths, but Lily knows it's just her unwavering determination to seek out the unknown.

One day, while exploring an old, abandoned library, Lily stumbles upon a dusty, leather-bound book. As she flips through its pages, she discovers a series of cryptic clues leading to a legendary treasure hidden deep within the mountains. Without hesitation, she packs her bag and sets off on her greatest adventure yet, ready to uncover the secrets that have eluded others for centuries.

---

Feel free to expand on this or let me know if you'd like to explore a different direction!"""

Evaluate the model

pip3 install lm-eval==0.4.5

auto-round --model "OPEA/DeepSeek-V2.5-1210-int4-sym-inc" --eval --eval_bs 8  --tasks leaderboard_ifeval,leaderboard_mmlu_pro,gsm8k,lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,cmmlu,ceval-valid --devices 0,1,2,3
Metric BF16 INT4
Avg
leaderboard_mmlu_pro 5 shots 0.521
leaderboard_ifeval inst_level_strict_acc
leaderboard_ifeval prompt_level_strict_acc
mmlu 0.7690
cmmlu
ceval-valid
gsm8k 5 shots
lambada_openai
hellaswag
winogrande
piqa
truthfulqa_mc1
openbookqa
boolq
arc_easy
arc_challenge

Generate the model

Here is the sample command to generate the model.

auto-round \
--model deepseek-ai/DeepSeek-V2.5-1210 \
--device 0 \
--disable_eval \
--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

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 github

Downloads last month
35
Inference API
Unable to determine this model's library. Check the docs .

Model tree for OPEA/DeepSeek-V2.5-1210-int4-sym-inc

Quantized
(7)
this model

Dataset used to train OPEA/DeepSeek-V2.5-1210-int4-sym-inc