Anhforth commited on
Commit
15e4261
1 Parent(s): 82b0f67

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -1
README.md CHANGED
@@ -36,7 +36,15 @@ import torch
36
  device = torch.device("cuda")
37
  model_info = "BAAI/Aquila2-34B"
38
  tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
39
- model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True)
 
 
 
 
 
 
 
 
40
  model.eval()
41
  model.to(device)
42
  text = "请给出10个要到北京旅游的理由。"
 
36
  device = torch.device("cuda")
37
  model_info = "BAAI/Aquila2-34B"
38
  tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
39
+ quantization_config=BitsAndBytesConfig(
40
+ load_in_4bit=True,
41
+ bnb_4bit_use_double_quant=True,
42
+ bnb_4bit_quant_type="nf4",
43
+ bnb_4bit_compute_dtype=torch.bfloat16,
44
+ )
45
+ model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True,
46
+ # quantization_config=quantization_config, # Uncomment this line for 4bit quantization
47
+ )
48
  model.eval()
49
  model.to(device)
50
  text = "请给出10个要到北京旅游的理由。"