(image_path, model)
| 11 | END = '\033[0m' |
| 12 | |
| 13 | def load_image(image_path, model): |
| 14 | transform_type = "padded_resize" # or "resized_center_crop" |
| 15 | transform = get_transform(transform_type, getattr(model.llma, 'image_size', 224)) |
| 16 | image = Image.open(image_path).convert("RGB") |
| 17 | return transform(image).unsqueeze(0).cuda().bfloat16() |
| 18 | |
| 19 | def main(model, image_path, instruction): |
| 20 | image = load_image(image_path, model) |