🚀 Gemma 3 for OpenArcが登場!
本プロジェクトのOpenArcはOpenVINO用の推論エンジンで、このモデルをサポートするようになりました。OpenAI互換のエンドポイントを通じて、テキスト生成と画像付きテキスト生成の推論を提供します。このリリースは本日または明日に行われます。
私たちは、IntelをAI/MLに活用することに興味のある人々が集まるDiscordコミュニティを持っています。

📦 インストール
このモデルは、以下のOptimum-CLIコマンドを使用してOpenVINO IR形式に変換されました。
optimum-cli export openvino -m ""input-model"" --task image-text-to-text --weight-format int8 ""converted-model""
💻 使用例
基本的な使用法
テストコードは何をするのでしょうか?
このコードは、Pythonでの推論方法と、パフォーマンスベンチマークに重要なコード部分を示しています。
テキスト生成と画像付きテキスト生成は、それぞれ異なる課題を持っています。例えば、ビジョンエンコーダは画像の特性を処理するために異なる戦略を使用することが多いです。
実際には、これは高いメモリ使用量、スループットの低下、または不良な結果につながります。
テストコードを実行するには、以下の手順を実行します。
- デバイス固有のドライバをインストールする
- Optimum-Intel for OpenVINOをソースからビルドする
- 最も魅力的な画像を見つける
pip install optimum[openvino]+https://github.com/huggingface/optimum-intel
import time
from PIL import Image
from transformers import AutoProcessor
from optimum.intel.openvino import OVModelForVisualCausalLM
model_id = "Echo9Zulu/gemma-3-4b-it-int8_asym-ov"
ov_config = {"PERFORMANCE_HINT": "LATENCY"}
print("Loading model... this should get faster after the first generation due to caching behavior.")
print("")
start_load_time = time.time()
model = OVModelForVisualCausalLM.from_pretrained(model_id, export=False, device="CPU", ov_config=ov_config)
processor = AutoProcessor.from_pretrained(model_id)
end_load_time = time.time()
image_path = r""
image = Image.open(image_path)
image = image.convert("RGB")
conversation = [
{
"role": "user",
"content": [
{
"type": "image"
},
{"type": "text", "text": "Describe this image."},
],
}
]
text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
inputs = processor(text=[text_prompt], images=[image], padding=True, return_tensors="pt")
input_token_count = len(inputs.input_ids[0])
print(f"Sum of image and text tokens: {len(inputs.input_ids[0])}")
start_time = time.time()
output_ids = model.generate(**inputs, max_new_tokens=1024)
generated_ids = [output_ids[len(input_ids) :] for input_ids, output_ids in zip(inputs.input_ids, output_ids)]
output_text = processor.batch_decode(generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True)
num_tokens_generated = len(generated_ids[0])
load_time = end_load_time - start_load_time
generation_time = time.time() - start_time
tokens_per_second = num_tokens_generated / generation_time
average_token_latency = generation_time / num_tokens_generated
print("\nPerformance Report:")
print("-"*50)
print(f"Input Tokens : {input_token_count:>9}")
print(f"Generated Tokens : {num_tokens_generated:>9}")
print(f"Model Load Time : {load_time:>9.2f} sec")
print(f"Generation Time : {generation_time:>9.2f} sec")
print(f"Throughput : {tokens_per_second:>9.2f} t/s")
print(f"Avg Latency/Token : {average_token_latency:>9.3f} sec")
print(output_text)
📄 ライセンス
このプロジェクトはApache-2.0ライセンスの下で提供されています。
属性 |
详情 |
モデルタイプ |
Gemma 3 for OpenArc |
変換元モデル |
google/gemma-3-4b-it |
タグ |
OpenArc、OpenVINO、Optimum-Intel、image-text-to-text |
ライセンス |
Apache-2.0 |