Hibernates-JP-1.3b-Max
This is a Japanese vision-language model based on LLaVA architecture with 1.3B parameters.
Model Details
- Model Type: Vision-Language Model
- Base Model: HibernatesGpt2 (1.3B parameters)
- Vision Encoder: ConvNeXt Large
- Training Data: Custom Japanese vision-language dataset
- Context Length: 1024 tokens
- Vision Resolution: 1280x1280
- License: Apache 2.0
Usage
[Add usage instructions here]
Training Details
- Vision Encoder: ConvNeXt Large
- Hidden Size: 2048
- Number of Attention Heads: 16
- Number of Layers: 24
- Vision Feature Selection: patch
- Vision Select Layer: -2
- Multimodal Projector Type: mlp2x_gelu
Limitations
[Add model limitations here]
Citation
[Add citation information if applicable]
Hibernates-JP-1.3b-Max Model Card
Hibernates-JP-1.3b-Max は高解像度(1280x1280)に対応した日本語マルチモーダル言語モデルです。画像理解と自然な対話を組み合わせ、視覚的なコンテキストについて日本語で会話することができます。
Updates in Latest Version
- 高解像度(1280x1280)での画像処理に対応
- 日本語での視覚言語理解を強化
- メモリ効率の改善とbfloat16による最適化
- 3段階の学習による精度向上
- 対話型の画像理解が可能
🌟 Key Features
- 高解像度対応: 1280x1280の高解像度画像処理をサポート
- 日本語最適化: 日本語での自然な対話と画像理解
- 効率的な処理: bfloat16とGradient Checkpointingによる最適化
- 3段階学習: 段階的な学習による高精度な視覚-言語理解
- 軽量モデル: 約1.7Bパラメータでの効率的な処理
Model Architecture
The model consists of:
- Vision Encoder: ConvNeXt Large (LAION-2B学習済み)
- Cross-Modal Projector: 2層MLPによる特徴量変換
- Language Model: LLM-JP 1.3B (日本語特化モデル)
- 総パラメータ数: 約1.7B
主な用途
- 🖼️ 画像説明生成
- 💬 画像に関する質問応答
- 🔍 視覚的詳細の分析
- 🗣️ マルチターン対話
- 📝 画像内容の要約
💻 Quick Start
基本的な使い方
import requests
import torch
import transformers
from PIL import Image
from transformers.generation.streamers import TextStreamer
from llava.constants import DEFAULT_IMAGE_TOKEN, IMAGE_TOKEN_INDEX
from llava.conversation import conv_templates, SeparatorStyle
from llava.model.llava_gpt2 import LlavaGpt2ForCausalLM
from llava.train.dataset import tokenizer_image_token
if __name__ == "__main__":
model_path = 'Hibernates/Hibernates-JP-1.3b-Max'
device = "cuda" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.bfloat16 if device=="cuda" else torch.float32
model = LlavaGpt2ForCausalLM.from_pretrained(
model_path,
low_cpu_mem_usage=True,
use_safetensors=True,
torch_dtype=torch_dtype,
device_map=device,
)
tokenizer = transformers.AutoTokenizer.from_pretrained(
model_path,
model_max_length=1532,
padding_side="right",
use_fast=False,
)
model.eval()
conv_mode = "v1"
conv = conv_templates[conv_mode].copy()
# image pre-process
image_url = "https://huggingface.co/rinna/bilingual-gpt-neox-4b-minigpt4/resolve/main/sample.jpg"
image = Image.open(requests.get(image_url, stream=True).raw).convert('RGB')
if device == "cuda":
image_tensor = model.get_model().vision_tower.image_processor(image).unsqueeze(0).half().cuda().to(torch_dtype)
else:
image_tensor = model.get_model().vision_tower.image_processor(image).unsqueeze(0).to(torch_dtype)
# create prompt
# ユーザー: <image>\n{prompt}
prompt = "猫の隣には何がありますか?"
inp = DEFAULT_IMAGE_TOKEN + '\n' + prompt
conv.append_message(conv.roles[0], inp)
conv.append_message(conv.roles[1], None)
prompt = conv.get_prompt()
input_ids = tokenizer_image_token(
prompt,
tokenizer,
IMAGE_TOKEN_INDEX,
return_tensors='pt'
).unsqueeze(0)
if device == "cuda":
input_ids = input_ids.to(device)
input_ids = input_ids[:, :-1] # </sep>がinputの最後に入るので削除する
stop_str = conv.sep if conv.sep_style != SeparatorStyle.TWO else conv.sep2
keywords = [stop_str]
streamer = TextStreamer(tokenizer, skip_prompt=True, timeout=20.0)
# predict
with torch.inference_mode():
output_id = model.generate(
inputs=input_ids,
images=image_tensor,
do_sample=False,
temperature=1.0,
top_p=1.0,
max_new_tokens=256,
streamer=streamer,
use_cache=True,
)
"""猫の隣にはノートパソコンがあります。"""
### 🔧 Advanced Usage
<details>
<summary>パラメータのカスタマイズ</summary>
```python
# 生成パラメータの調整
model.generate(
temperature=0.8, # 創造性の制御
top_p=0.95, # サンプリングの多様性
max_new_tokens=1024 # 生成テキストの長さ
)
Training dataset
データセット構成
Stage1 and Stage2 Pretrain
Stage3 Fine-tuning
📊 System Requirements
- GPU: NVIDIA GPU with 12GB+ VRAM
- RAM: 16GB+
- Storage: 10GB for model weights
- Python: 3.8+
Acknowledgement
本モデルは以下のプロジェクトの成果を活用しています:
License
このプロジェクトは Creative Commons Attribution-NonCommercial 4.0 International License の下でライセンスされています。
- Downloads last month
- 3
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
HF Inference API was unable to determine this model's library.