在我们的实验中,我们使用GLM-4v-9b为练习过的图像添加标注。具体来说,我们使用query = "please describe this image into prompt words, and reply us with keywords like xxx, xxx, xxx, xxx"来提示 VLM 输出图片标注。例如,我们可以使用 GLM-4v 为单张图像添加prompt:
import torch
from PIL import Image
from transformers import AutoModelForCausalLM, AutoTokenizer