🚀 SpaceQwen2.5-VL-3B-Instruct
このモデルは、マルチモーダルモデルの空間推論能力を強化するために、データ合成技術と公開されているモデルを使用しています。シーン内のオブジェクト間の空間関係を推論し、空間推論用のVQAデータセットを作成することができます。
🚀 クイックスタート
✨ 主な機能
- モデルタイプ:マルチモーダル、ビジョン言語モデル
- アーキテクチャ:
Qwen2.5-VL-3B-Instruct
- モデルサイズ:37.5億パラメータ (FP16)
- ファインチューニング元:Qwen/Qwen2.5-VL-3B-Instruct
- ファインチューニング戦略:LoRA (低ランク適応)
- ライセンス:Apache-2.0
このモデルは、データ合成技術と公開されているモデルを使用して、SpatialVLMで説明されている作業を再現し、マルチモーダルモデルの空間推論能力を強化します。エキスパートモデルのパイプラインを使用して、シーン内のオブジェクト間の空間関係を推論し、空間推論用のVQAデータセットを作成することができます。
📦 インストール
Transformers
qwenの依存関係をインストールします。
pip install qwen-vl-utils[decord]==0.0.8
💻 使用例
基本的な使用法
サンプル画像で推論を実行するには、次のコードを使用します。
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"remyxai/SpaceQwen2.5-VL-3B-Instruct", torch_dtype="auto", device_map="auto"
)
processor = AutoProcessor.from_pretrained("remyxai/SpaceQwen2.5-VL-3B-Instruct")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://raw.githubusercontent.com/remyxai/VQASynth/refs/heads/main/assets/warehouse_sample_2.jpeg",
},
{"type": "text", "text": "What is the height of the man in the red hat in feet?"},
],
}
]
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
高度な使用法
SpaceQwen2.5-VL-3B-Instructをllama.cppを使用して実行するには、次のコマンドを使用します。
./llama-qwen2vl-cli -m /path/to/SpaceQwen2.5-VL-3B-Instruct/SpaceQwen2.5-VL-3B-Instruct-F16.gguf \
--mmproj /path/to/SpaceQwen2.5-VL-3B-Instruct/spaceqwen2.5-vl-3b-instruct-vision.gguf \
-p "What's the height of the man in the red hat?" \
--image /path/to/warehouse_sample_2.jpeg --threads 24 -ngl 99
📚 ドキュメント
データセットとトレーニング
SpaceQwen2.5-VL-3B-Instructは、OpenSpacesデータセットでQwen2.5-VL-3B-InstructをLoRAでファインチューニングしています。
データセットの概要:
LoRA SFTのスクリプトは、trlで入手できます。
モデル評価 (近日公開)
VLMEvalKit QSpatialベンチマークの更新にご期待ください。
予定されている比較:
DiscordまたはHF spaceで試すこともできます。
🔧 技術詳細
制限事項と倫理的な考慮事項
- 混雑した環境やカメラの視点では、性能が低下する可能性があります。
- このモデルは、インターネット上の画像データセットに対する合成推論を使用してファインチューニングされています。
- ベースモデル (Qwen2.5-VL) に固有のマルチモーダルバイアスが残る可能性があります。
- 安全上重要な決定や法的な決定には使用しないでください。
ユーザーは、出力を批判的に評価し、ドメイン固有の安全性とパフォーマンスのためにファインチューニングを検討することをお勧めします。
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で提供されています。
引用
@article{chen2024spatialvlm,
title = {SpatialVLM: Endowing Vision-Language Models with Spatial Reasoning Capabilities},
author = {Chen, Boyuan and Xu, Zhuo and Kirmani, Sean and Ichter, Brian and Driess, Danny and Florence, Pete and Sadigh, Dorsa and Guibas, Leonidas and Xia, Fei},
journal = {arXiv preprint arXiv:2401.12168},
year = {2024},
url = {https://arxiv.org/abs/2401.12168},
}
@misc{qwen2.5-VL,
title = {Qwen2.5-VL},
url = {https://qwenlm.github.io/blog/qwen2.5-vl/},
author = {Qwen Team},
month = {January},
year = {2025}
}