lrl-modelcloud commited on
Commit
f96bb73
·
verified ·
1 Parent(s): 78573ee

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -0
README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This model has been quantized using [GPTQModel](https://github.com/ModelCloud/GPTQModel).
2
+
3
+ - **bits**: 4
4
+ - **group_size**: 128
5
+ - **desc_act**: true
6
+ - **static_groups**: false
7
+ - **sym**: true
8
+ - **lm_head**: false
9
+ - **damp_percent**: 0.01
10
+ - **true_sequential**: true
11
+ - **model_name_or_path**: ""
12
+ - **model_file_base_name**: "model"
13
+ - **quant_method**: "gptq"
14
+ - **checkpoint_format**: "gptq"
15
+ - **meta**:
16
+ - **quantizer**: "gptqmodel:0.9.9-dev0"
17
+
18
+
19
+ You can use [GPTQModel](https://github.com/ModelCloud/GPTQModel) for model inference.
20
+ ```python
21
+ import torch
22
+ from transformers import AutoTokenizer, GenerationConfig
23
+ from gptqmodel import GPTQModel
24
+ model_name = "/monster/data/model/DeepSeek-V2-Chat-0628/gptq_gptq_4_0719/"
25
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
26
+ # `max_memory` should be set based on your devices
27
+ max_memory = {i: "75GB" for i in range(2)}
28
+ # `device_map` cannot be set to `auto`
29
+ model = GPTQModel.from_quantized(model_name, trust_remote_code=True, device_map="sequential", max_memory=max_memory, torch_dtype=torch.float16, attn_implementation="eager")
30
+
31
+ model.generation_config = GenerationConfig.from_pretrained(model_name)
32
+ model.generation_config.pad_token_id = model.generation_config.eos_token_id
33
+
34
+ messages = [
35
+ {"role": "user", "content": "Write a piece of quicksort code in C++"}
36
+ ]
37
+ input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
38
+ outputs = model.generate(input_ids=input_tensor.to(model.device), max_new_tokens=100)
39
+ result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
40
+ print(result)
41
+
42
+ ```