ShreyMehra commited on
Commit
5c61a9c
·
unverified ·
1 Parent(s): fda5fae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -35,8 +35,8 @@ class UI:
35
  print(2)
36
  pixel_values = inputs.pixel_values
37
 
38
- print(3)
39
- pixel_values = pixel_values.to(torch.float32)
40
 
41
  print(4)
42
  generated_ids = model.generate(pixel_values=pixel_values, max_length=25)
@@ -58,9 +58,8 @@ class Model:
58
  config = PeftConfig.from_pretrained(peft_model_id)
59
  global model
60
  global processor
61
- model = Blip2ForConditionalGeneration.from_pretrained(config.base_model_name_or_path, low_cpu_mem_usage=True, torch_dtype=torch.float16) #, device_map="auto", load_in_8bit=True
62
- model = PeftModel.from_pretrained(model, peft_model_id).to(torch.float32)
63
-
64
  processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
65
 
66
  def query(self , payload):
 
35
  print(2)
36
  pixel_values = inputs.pixel_values
37
 
38
+ # print(3)
39
+ # pixel_values = pixel_values.to(torch.float32)
40
 
41
  print(4)
42
  generated_ids = model.generate(pixel_values=pixel_values, max_length=25)
 
58
  config = PeftConfig.from_pretrained(peft_model_id)
59
  global model
60
  global processor
61
+ model = Blip2ForConditionalGeneration.from_pretrained(config.base_model_name_or_path, low_cpu_mem_usage=True, torch_dtype=torch.float32) #, device_map="auto", load_in_8bit=True
62
+ model = PeftModel.from_pretrained(model, peft_model_id)
 
63
  processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
64
 
65
  def query(self , payload):