Spaces:
Runtime error
Runtime error
Update model.py
Browse files
model.py
CHANGED
|
@@ -379,8 +379,11 @@ class StreamMultiDiffusion(nn.Module):
|
|
| 379 |
A single string of text prompt.
|
| 380 |
"""
|
| 381 |
question = 'Question: What are in the image? Answer:'
|
|
|
|
| 382 |
inputs = self.i2t_processor(image, question, return_tensors='pt')
|
|
|
|
| 383 |
out = self.i2t_model.generate(**inputs, max_new_tokens=77)
|
|
|
|
| 384 |
prompt = self.i2t_processor.decode(out[0], skip_special_tokens=True).strip()
|
| 385 |
return prompt
|
| 386 |
|
|
@@ -450,9 +453,7 @@ class StreamMultiDiffusion(nn.Module):
|
|
| 450 |
flag_changed = False
|
| 451 |
if image is not None:
|
| 452 |
image_ = image.resize((self.width, self.height))
|
| 453 |
-
print('111111111111111111111111', self.device, self.pipe.device)
|
| 454 |
prompt = self.get_text_prompts(image_) if prompt is None else prompt
|
| 455 |
-
print('2222222222222222222222', self.device, self.pipe.device)
|
| 456 |
negative_prompt = '' if negative_prompt is None else negative_prompt
|
| 457 |
embed = self.pipe.encode_prompt(
|
| 458 |
prompt=[prompt],
|
|
|
|
| 379 |
A single string of text prompt.
|
| 380 |
"""
|
| 381 |
question = 'Question: What are in the image? Answer:'
|
| 382 |
+
print(self.i2t_processor.device, self.i2t_model.device)
|
| 383 |
inputs = self.i2t_processor(image, question, return_tensors='pt')
|
| 384 |
+
print(inputs)
|
| 385 |
out = self.i2t_model.generate(**inputs, max_new_tokens=77)
|
| 386 |
+
print(out[0].device)
|
| 387 |
prompt = self.i2t_processor.decode(out[0], skip_special_tokens=True).strip()
|
| 388 |
return prompt
|
| 389 |
|
|
|
|
| 453 |
flag_changed = False
|
| 454 |
if image is not None:
|
| 455 |
image_ = image.resize((self.width, self.height))
|
|
|
|
| 456 |
prompt = self.get_text_prompts(image_) if prompt is None else prompt
|
|
|
|
| 457 |
negative_prompt = '' if negative_prompt is None else negative_prompt
|
| 458 |
embed = self.pipe.encode_prompt(
|
| 459 |
prompt=[prompt],
|