avanish07 commited on
Commit
c88667a
·
1 Parent(s): 4638dbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -22,10 +22,12 @@ from langchain.prompts import PromptTemplate
22
 
23
  from IPython.display import Markdown, display
24
 
25
- peft_model_id = "./"
26
  config = PeftConfig.from_pretrained(peft_model_id)
27
 
28
  bnb_config = BitsAndBytesConfig(
 
 
29
  load_in_4bit=True,
30
  bnb_4bit_use_double_quant=True,
31
  bnb_4bit_quant_type="nf4",
@@ -36,7 +38,7 @@ model = AutoModelForCausalLM.from_pretrained(
36
  config.base_model_name_or_path,
37
  return_dict=True,
38
  quantization_config=bnb_config,
39
- device_map="auto",
40
  trust_remote_code=True,
41
  )
42
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
 
22
 
23
  from IPython.display import Markdown, display
24
 
25
+ peft_model_id = "adapter_model.bin"
26
  config = PeftConfig.from_pretrained(peft_model_id)
27
 
28
  bnb_config = BitsAndBytesConfig(
29
+ load_in_8bit_fp32_cpu_offload=True,
30
+ bnb_8bit_use_fp16=False
31
  load_in_4bit=True,
32
  bnb_4bit_use_double_quant=True,
33
  bnb_4bit_quant_type="nf4",
 
38
  config.base_model_name_or_path,
39
  return_dict=True,
40
  quantization_config=bnb_config,
41
+ device_map={"cuda:0": "cpu"},
42
  trust_remote_code=True,
43
  )
44
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)