InternVL
InternVL copied to clipboard
InternViT−6B−448px−V1.5动态分辨率如何支持
请问一下,我按照InternViT−6B−448px−V1.5的示例代码,经过图像前处理,发现一个长宽比不为1的图片仍然经过了centercrop,请问如何支持动态分辨率?
补充示例代码
import torch
from PIL import Image
from transformers import AutoModel, CLIPImageProcessor
model = AutoModel.from_pretrained(
'OpenGVLab/InternViT-6B-448px-V1-5',
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
trust_remote_code=True).cuda().eval()
image = Image.open('./examples/image1.jpg').convert('RGB')
image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-6B-448px-V1-5')
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
pixel_values = pixel_values.to(torch.bfloat16).cuda()
outputs = model(pixel_values)
您好,readme写的不够好,给您带来困扰了。 请使用这里的load_image函数加载图像并进行切图,然后再送入ViT:
https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5#model-usage
This issue has been inactive for two months, so I am closing it. If you have any further questions or encounter any problems, please feel free to reopen it. Thank you!