Update handler.py
Browse files- handler.py +5 -3
handler.py
CHANGED
@@ -13,8 +13,10 @@ class EndpointHandler():
|
|
13 |
def __init__(self, path=""):
|
14 |
self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
15 |
print("device:",self.device)
|
16 |
-
self.model_base = "Salesforce/blip2-opt-2.7b"
|
17 |
-
self.model_name = "sooh-j/blip2-vizwizqa"
|
|
|
|
|
18 |
self.processor = AutoProcessor.from_pretrained(self.model_name)
|
19 |
self.model = Blip2ForConditionalGeneration.from_pretrained(self.model_name,
|
20 |
device_map="auto",
|
@@ -50,7 +52,7 @@ class EndpointHandler():
|
|
50 |
|
51 |
with torch.no_grad():
|
52 |
out = self.model.generate(**processed,
|
53 |
-
max_new_tokens=
|
54 |
temperature = 0.5,
|
55 |
do_sample=True,
|
56 |
top_k=50,
|
|
|
13 |
def __init__(self, path=""):
|
14 |
self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
15 |
print("device:",self.device)
|
16 |
+
# self.model_base = "Salesforce/blip2-opt-2.7b"
|
17 |
+
# self.model_name = "sooh-j/blip2-vizwizqa"
|
18 |
+
self.model_name = "Salesforce/blip2-opt-2.7b"
|
19 |
+
|
20 |
self.processor = AutoProcessor.from_pretrained(self.model_name)
|
21 |
self.model = Blip2ForConditionalGeneration.from_pretrained(self.model_name,
|
22 |
device_map="auto",
|
|
|
52 |
|
53 |
with torch.no_grad():
|
54 |
out = self.model.generate(**processed,
|
55 |
+
max_new_tokens=20,
|
56 |
temperature = 0.5,
|
57 |
do_sample=True,
|
58 |
top_k=50,
|