1つの質問文に対して複数画像を入力する方法

#1
by speed - opened

素晴らしいモデル開発ありがとうございます.
2つの画像が与えられたときに, "二つの画像の違いはなんですか?"というような質問文に答えさせたいのですが, どのようにすれば, 複数画像を入力できますでしょうか?

SB Intuitions org

複数枚画像を入力とした学習をしていないため動作の保証はできませんが、テキストプロンプトに<|prefix|><|file|><|suffix|>というテキストを入れていただければその位置に画像トークンを挿入することができます。
例えばプロンプトの先頭に2枚画像を入れたい場合、次のように書くことができます。

text_prompt = """<s><|prefix|><|file|><|suffix|><|prefix|><|file|><|suffix|>A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.

### Human: この写真に写っているもので、最も有名と考えられる建築物は何でどこに写っていますか?
### Assistant:"""

image1 = Image.open(xxx)
image2 = Image.open(xxx)
inputs = processor(
    text=[text_prompt],
    images=[image1, image2],
    padding=True,
    return_tensors="pt",
)

ありがとうございます!

speed changed discussion status to closed
Your need to confirm your account before you can post a new comment.

Sign up or log in to comment