unum-cloud / uform

Pocket-Sized Multimodal AI for content understanding and generation across multilingual texts, images, and 🔜 video, up to 5x faster than OpenAI CLIP and LLaVA 🖼️ & 🖋️
https://unum-cloud.github.io/uform/
Apache License 2.0
982 stars 56 forks source link

Problem with Batch Input #72

Closed afsaneh-ebrahimi closed 3 months ago

afsaneh-ebrahimi commented 4 months ago

Hi,

Thanks for your repository. I have a question, when I want to give a batch of data points to the model I face with the following error:

for batch_idx, (inputs, targets) in enumerate(test_loader): ----> 9 image_info = model.preprocess_image(inputs).unsqueeze(0) 10 #image_info = model.preprocess_image(images).unsqueeze(0)

2 frames /usr/local/lib/python3.10/dist-packages/uform/models.py in convert_to_rgb(image) 21 # lambda is not pickable 22 def convert_to_rgb(image): ---> 23 return image.convert("RGB")

AttributeError: 'Tensor' object has no attribute 'convert'

kimihailv commented 4 months ago

Hello. As I understand, inputs is tensor, yes? model.preprocess_image expects PIL image(s)