Spaces:
Runtime error
Runtime error
Upload tool
Browse files- blip_tool.py +1 -4
blip_tool.py
CHANGED
@@ -47,8 +47,6 @@ class InstructBLIPImageQuestionAnsweringTool(PipelineTool):
|
|
47 |
else:
|
48 |
self.device = get_default_device()
|
49 |
|
50 |
-
# if self.device_map is None:
|
51 |
-
# self.model.to(self.device)
|
52 |
self.is_initialized = True
|
53 |
|
54 |
def encode(self, image, question: str):
|
@@ -57,14 +55,13 @@ class InstructBLIPImageQuestionAnsweringTool(PipelineTool):
|
|
57 |
def forward(self, inputs):
|
58 |
outputs = self.model.generate(
|
59 |
**inputs,
|
60 |
-
#max_new_tokens=50,
|
61 |
num_beams=5,
|
62 |
max_new_tokens=256,
|
63 |
min_length=1,
|
64 |
top_p=0.9,
|
65 |
repetition_penalty=1.5,
|
66 |
length_penalty=1.0,
|
67 |
-
temperature=
|
68 |
)
|
69 |
return outputs
|
70 |
|
|
|
47 |
else:
|
48 |
self.device = get_default_device()
|
49 |
|
|
|
|
|
50 |
self.is_initialized = True
|
51 |
|
52 |
def encode(self, image, question: str):
|
|
|
55 |
def forward(self, inputs):
|
56 |
outputs = self.model.generate(
|
57 |
**inputs,
|
|
|
58 |
num_beams=5,
|
59 |
max_new_tokens=256,
|
60 |
min_length=1,
|
61 |
top_p=0.9,
|
62 |
repetition_penalty=1.5,
|
63 |
length_penalty=1.0,
|
64 |
+
temperature=0.7,
|
65 |
)
|
66 |
return outputs
|
67 |
|