Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ def inference(prompt, image):
|
|
| 38 |
text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
|
| 39 |
input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
|
| 40 |
|
| 41 |
-
image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
|
| 42 |
|
| 43 |
# generate
|
| 44 |
output_ids = model.generate(
|
|
|
|
| 38 |
text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
|
| 39 |
input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
|
| 40 |
|
| 41 |
+
image_tensor = model.process_images([image], model.config).to(dtype=model.dtype, device=model.device) # Move to model's device
|
| 42 |
|
| 43 |
# generate
|
| 44 |
output_ids = model.generate(
|