huihui-ai commited on
Commit
88fde67
·
verified ·
1 Parent(s): 9b8ea7f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md CHANGED
@@ -13,3 +13,41 @@ language:
13
  # huihui-ai/dots.llm1.inst
14
 
15
  This version only allows local loading of dots.llm1.inst using transformers, with only the local import issue modified and no other changes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  # huihui-ai/dots.llm1.inst
14
 
15
  This version only allows local loading of dots.llm1.inst using transformers, with only the local import issue modified and no other changes.
16
+
17
+ ## Usage
18
+ Copy the four files to the model directory, and then you can use the following program.
19
+
20
+ ```
21
+ import sys
22
+ import os
23
+ import torch
24
+ from transformers import AutoTokenizer, AutoConfig, AutoModel, BitsAndBytesConfig
25
+
26
+ AutoConfig.register("dots1", Dots1Config)
27
+ AutoModel.register(Dots1Config, Dots1ForCausalLM)
28
+
29
+ config = AutoConfig.from_pretrained(MODEL_ID)
30
+ print(config)
31
+
32
+ quant_config_4 = BitsAndBytesConfig(
33
+ load_in_4bit=True,
34
+ bnb_4bit_compute_dtype=torch.bfloat16,
35
+ bnb_4bit_use_double_quant=True,
36
+ llm_int8_enable_fp32_cpu_offload=True,
37
+ )
38
+
39
+ model = Dots1ForCausalLM.from_pretrained(
40
+ MODEL_ID,
41
+ device_map="auto",
42
+ trust_remote_code=True,
43
+ quantization_config=quant_config_4,
44
+ torch_dtype=torch.bfloat16,
45
+ low_cpu_mem_usage=True,
46
+ )
47
+
48
+ print(model)
49
+ print(model.config)
50
+
51
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
52
+
53
+ ```