Skip to content

Commit d073c48

Browse files
authored
Merge pull request #3277 from vladmandic/dev
refresh master
2 parents 8deb6a6 + 3e6282b commit d073c48

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/vqa.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def moondream(question: str, image: Image.Image, repo: str = None):
128128

129129
def florence(question: str, image: Image.Image, repo: str = None):
130130
global processor, model, loaded # pylint: disable=global-statement
131+
from installer import install, installed
132+
if not installed('flash_attn', quiet=True):
133+
install('flash_attn')
131134
if model is None or loaded != repo:
132135
model = transformers.AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True)
133136
processor = transformers.AutoProcessor.from_pretrained(repo, trust_remote_code=True)
@@ -162,8 +165,6 @@ def florence(question: str, image: Image.Image, repo: str = None):
162165

163166

164167
def interrogate(vqa_question, vqa_image, vqa_model_req):
165-
from installer import install
166-
install('flash_attn', quiet=True)
167168
vqa_model = MODELS.get(vqa_model_req, None)
168169
shared.log.debug(f'VQA: model="{vqa_model}" question="{vqa_question}" image={vqa_image}')
169170
if vqa_image is None:

0 commit comments

Comments
 (0)