Image-to-Text
Transformers
Safetensors
Japanese
English
sarashina2_vision
text-generation
multimodal
vision-language
llama
qwen2_vl
custom_code
Instructions to use sbintuitions/sarashina2-vision-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sbintuitions/sarashina2-vision-8b with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="sbintuitions/sarashina2-vision-8b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("sbintuitions/sarashina2-vision-8b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
1つの質問文に対して複数画像を入力する方法
#1
by speed - opened
素晴らしいモデル開発ありがとうございます.
2つの画像が与えられたときに, "二つの画像の違いはなんですか?"というような質問文に答えさせたいのですが, どのようにすれば, 複数画像を入力できますでしょうか?
複数枚画像を入力とした学習をしていないため動作の保証はできませんが、テキストプロンプトに<|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