Anhforth commited on
Commit
17734e6
1 Parent(s): 5220fea

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -1
README.md CHANGED
@@ -24,11 +24,21 @@ The additional details of the Aquila model will be presented in the official tec
24
 
25
  ```python
26
  from transformers import AutoTokenizer, AutoModelForCausalLM
 
27
  import torch
 
28
  device = torch.device("cuda:0")
29
  model_info = "BAAI/AquilaChat2-34B"
30
  tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
31
- model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16)
 
 
 
 
 
 
 
 
32
  model.eval()
33
  model.to(device)
34
  text = "请给出10个要到北京旅游的理由。"
 
24
 
25
  ```python
26
  from transformers import AutoTokenizer, AutoModelForCausalLM
27
+ from transformers import BitsAndBytesConfig
28
  import torch
29
+
30
  device = torch.device("cuda:0")
31
  model_info = "BAAI/AquilaChat2-34B"
32
  tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
33
+ quantization_config=BitsAndBytesConfig(
34
+ load_in_4bit=True,
35
+ bnb_4bit_use_double_quant=True,
36
+ bnb_4bit_quant_type="nf4",
37
+ bnb_4bit_compute_dtype=torch.bfloat16,
38
+ )
39
+ model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16
40
+ # quantization_config=quantization_config, # Uncomment this line for 4bit quantization
41
+ )
42
  model.eval()
43
  model.to(device)
44
  text = "请给出10个要到北京旅游的理由。"