Views
No views yet
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:huggingface-cli download OPEA/DeepSeek-V2.5-1210-int4-sym-inc --revision 6d3d2cf1from auto_round import AutoRoundConfig ##must import for auto-round format
2from transformers import AutoModelForCausalLM, AutoTokenizer,GenerationConfig
3import torch
4quantized_model_dir="OPEA/DeepSeek-V2.5-1210-int4-sym-inc"
5max_memory = {i: "75GB" for i in range(2)}
6
7model = AutoModelForCausalLM.from_pretrained(
8 quantized_model_dir,
9 torch_dtype=torch.float16,
10 device_map="sequential",
11 attn_implementation="eager",
12 trust_remote_code=True,
13 max_memory=max_memory,
14 ##revision="6d3d2cf" ##AutoGPTQ format
15
16)
17model.generation_config = GenerationConfig.from_pretrained(model_name)
18model.generation_config.pad_token_id = model.generation_config.eos_token_id
19
20tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir,trust_remote_code=True)
21prompt = "There is a girl who likes adventure,"
22messages = [
23 {"role": "user", "content": prompt}
24]
25
26text = tokenizer.apply_chat_template(
27 messages,
28 tokenize=False,
29 add_generation_prompt=True
30)
31model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
32
33generated_ids = model.generate(
34 model_inputs.input_ids,
35 max_new_tokens=512, ##change this to align with the official usage
36 do_sample=False ##change this to align with the official usage
37)
38generated_ids = [
39output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
40]
41
42response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
43print(response)
44
45
46
47prompt = "strawberry中有几个r?"
48##INT4
49"""### 第一步:理解问题
50
51首先,我需要明确问题的含义。问题是:“strawberry中有几个r?” 这里的“strawberry”指的是一种水果,而“r”则是英文字母。问题实际上是在问,单词“strawberry”中包含了多少个字母“r”。
52
53### 第二步:分析单词结构
54
55为了回答这个问题,我需要仔细分析单词“strawberry”的结构,找出其中所有的字母“r”。
56
57单词“strawberry”拼写如下:
58
59```
60s t r a w b e r r y
61```
62
63### 第三步:逐个字母检查
64
65接下来,我将逐个字母检查,看看哪些字母是“r”。
66
671. **s** - 不是“r”
682. **t** - 不是“r”
693. **r** - 是“r”
704. **a** - 不是“r”
715. **w** - 不是“r”
726. **b** - 不是“r”
737. **e** - 不是“r”
748. **r** - 是“r”
759. **r** - 是“r”
7610. **y** - 不是“r”
77
78### 第四步:统计“r”的数量
79
80通过上述检查,我发现单词“strawberry”中共有三个字母“r”。
81
82### 第五步:验证结果
83
84为了确保我的答案正确,我再次检查了单词的拼写,并重新数了一遍“r”的数量,确认确实有三个“r”。
85
86### 最终答案
87
88综上所述,单词“strawberry”中共有**三个**字母“r”。"""
89
90
91prompt = "9.11和9.8哪个数字大"
92
93##INT4
94"""要比较 **9.11** 和 **9.8** 的大小,可以按照以下步骤进行:
95
961. **比较整数部分**:
97 - 两个数的整数部分都是 **9**,因此需要比较小数部分。
98
992. **比较小数部分**:
100 - **9.11** 的小数部分是 **0.11**
101 - **9.8** 的小数部分是 **0.8**
102
1033. **比较小数部分的大小**:
104 - **0.8** 大于 **0.11**
105
1064. **得出结论**:
107 - 由于小数部分 **0.8** 大于 **0.11**,所以 **9.8** 大于 **9.11**。
108
109最终答案是:
110
111\[
112\boxed{9.8}
113\]"""
114
115
116prompt = "Please give a brief introduction of DeepSeek company."
117##INT4:"""DeepSeek Artificial Intelligence Co., Ltd. (referred to as "DeepSeek" or "深度求索") , founded in 2023, is a Chinese company dedicated to making AGI a reality."""
118
119prompt = "There is a girl who likes adventure,"
120##INT4:
121"""It sounds like you're setting the stage for a story or a character introduction! Here's a little continuation to spark your imagination:
122
123---
124
125There 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.
126
127Her 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.
128
129One 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.
130
131---
132
133Feel free to expand on this or let me know if you'd like to explore a different direction!"""
134auto-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 |
1auto-round \
2--model deepseek-ai/DeepSeek-V2.5-1210 \
3--device 0 \
4--disable_eval \
5--format 'auto_gptq,auto_round' \
6--output_dir "./tmp_autoround"