Monimoy commited on
Commit
f47ce92
·
verified ·
1 Parent(s): c152cc1

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -13,8 +13,9 @@ base_model_name = "microsoft/phi-2"
13
  peft_model_path = "./phi2-openassistant-lora-final"
14
 
15
  # Load the base model with 4-bit quantization
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
 
19
  # Load LoRA adapter
20
  model = PeftModel.from_pretrained(base_model, peft_model_path)
@@ -49,4 +50,5 @@ iface = gr.Interface(
49
  )
50
 
51
  # Launch Gradio app
52
- iface.launch()
 
 
13
  peft_model_path = "./phi2-openassistant-lora-final"
14
 
15
  # Load the base model with 4-bit quantization
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
 
20
  # Load LoRA adapter
21
  model = PeftModel.from_pretrained(base_model, peft_model_path)
 
50
  )
51
 
52
  # Launch Gradio app
53
+ iface.launch()
54
+