Monimoy commited on
Commit
171feaa
·
verified ·
1 Parent(s): 0511f92

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -16,7 +16,18 @@ peft_model_path = "./phi2-openassistant-lora-final"
16
  #bnb_config = BitsAndBytesConfig(load_in_4bit=True) # Ensure compatibility
17
  #base_model = AutoModelForCausalLM.from_pretrained(base_model_name, quantization_config=bnb_config, device_map={"": device})
18
  #base_model = AutoModelForCausalLM.from_pretrained(base_model_name, torch_dtype=torch.float32, device_map={"": device})
19
- base_model = AutoModelForCausalLM.from_pretrained(base_model_name, load_in_4bit=True, device_map={"": device})
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  # Load LoRA adapter
22
  model = PeftModel.from_pretrained(base_model, peft_model_path)
 
16
  #bnb_config = BitsAndBytesConfig(load_in_4bit=True) # Ensure compatibility
17
  #base_model = AutoModelForCausalLM.from_pretrained(base_model_name, quantization_config=bnb_config, device_map={"": device})
18
  #base_model = AutoModelForCausalLM.from_pretrained(base_model_name, torch_dtype=torch.float32, device_map={"": device})
19
+ #base_model = AutoModelForCausalLM.from_pretrained(base_model_name, load_in_4bit=True, device_map={"": device})
20
+ bnb_config = BitsAndBytesConfig(
21
+ load_in_4bit=True,
22
+ bnb_4bit_compute_dtype=torch.float16,
23
+ bnb_4bit_quant_type="nf4",
24
+ bnb_4bit_use_double_quant=True,
25
+ )
26
+ base_model = AutoModelForCausalLM.from_pretrained(base_model_name, quantization_config=bnb_config, device_map={"": device})
27
+
28
+
29
+
30
+
31
 
32
  # Load LoRA adapter
33
  model = PeftModel.from_pretrained(base_model, peft_model_path)