BAAI
/

Anhforth commited on
Commit
a5dbc58
1 Parent(s): b0e9c7f

Update README.md

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