🚀 Hiber-Multi-10B-Instruct
最先端のトランスフォーマーアーキテクチャに基づく多言語言語モデルで、高度な性能と機能を備えています。
属性 |
详情 |
ライセンス |
llama3.1 |
サポート言語 |
en, zh, es, fr, de, ja, ko, ru |
ベースモデル |
meta-llama/Llama-3.1-8B-Instruct |
パイプラインタグ |
text-generation |
ライブラリ名 |
transformers |
タグ |
text-generation-inference, hiber-multi, safetensors, Llama3.1, multilingual-llm, instruction-tuning, flash-attention2, quantization |
🚀 クイックスタート
このモデルは、高度なトランスフォーマーアーキテクチャに基づいて構築された最先端の多言語言語モデルです。以下に、モデルの仕様を示します。
MODEL_SPECS = {
"architecture": "Decoder-only Transformer",
"params": "10B",
"context_length": 4096,
"hidden_size": 4096,
"attention_heads": 32,
"kv_heads": 8,
"intermediate_size": 14336,
"num_layers": 48,
"vocab_size": 32000,
"position_encoding": "Rotary",
"activation": "SwiGLU",
"norm_type": "RMSNorm"
}
✨ 主な機能
主要コンポーネント
-
高度なアテンションメカニズム
- 32ヘッドのマルチクエリアテンション
- 8個のKVヘッドを持つグループ化クエリアテンション
- Flash Attention 2.0の最適化
- 長いシーケンスに対するスライディングウィンドウアテンション
-
アーキテクチャの革新
- SwiGLU活性化関数
- RMSNormレイヤー正規化
- ロータリー位置埋め込み (RoPE)
- 適応的KVキャッシュ
- エキスパート混合ルーティング
💻 使用例
基本的な使用法
from dataclasses import dataclass
from typing import Optional, List, Dict, Union
import torch
import torch.nn.functional as F
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
@dataclass
class GenerationConfig:
temperature: float = 0.7
top_p: float = 0.9
top_k: int = 50
repetition_penalty: float = 1.1
max_new_tokens: int = 512
do_sample: bool = True
num_beams: int = 1
class HiberMultiPipeline:
def __init__(
self,
model_name: str = "Hiber-Multi-10B-Instruct",
device_map: str = "auto",
torch_dtype: Optional[torch.dtype] = torch.bfloat16,
load_in_8bit: bool = False,
load_in_4bit: bool = False,
):
self.config = AutoConfig.from_pretrained(model_name)
self.tokenizer = AutoTokenizer.from_pretrained(
model_name,
padding_side="left",
truncation_side="left",
)
quantization_config = None
if load_in_8bit or load_in_4bit:
from transformers import BitsAndBytesConfig
quantization_config = BitsAndBytesConfig(
load_in_8bit=load_in_8bit,
load_in_4bit=load_in_4bit,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_quant_type="nf4",
)
self.model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map=device_map,
torch_dtype=torch_dtype,
quantization_config=quantization_config,
trust_remote_code=True,
)
def generate(
self,
messages: List[Dict[str, str]],
generation_config: Optional[GenerationConfig] = None,
) -> str:
if generation_config is None:
generation_config = GenerationConfig()
prompt = self.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = self.tokenizer(
prompt,
return_tensors="pt",
padding=True,
truncation=True,
max_length=self.config.max_position_embeddings,
).to(self.model.device)
with torch.inference_mode():
outputs = self.model.generate(
**inputs,
pad_token_id=self.tokenizer.pad_token_id,
bos_token_id=self.tokenizer.bos_token_id,
eos_token_id=self.tokenizer.eos_token_id,
**asdict(generation_config),
)
response = self.tokenizer.decode(
outputs[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True,
)
return response.strip()
@torch.inference_mode()
def batch_generate(
self,
batch_messages: List[List[Dict[str, str]]],
generation_config: Optional[GenerationConfig] = None,
batch_size: int = 8,
) -> List[str]:
responses = []
for i in range(0, len(batch_messages), batch_size):
batch = batch_messages[i:i + batch_size]
responses.extend([
self.generate(msgs, generation_config)
for msgs in batch
])
return responses
🔧 技術詳細
メモリ使用量
- FP16: 20GB VRAM
- INT8: 12GB VRAM
- INT4: 8GB VRAM
スループット (A100 GPU)
- バッチサイズ1: 32トークン/秒
- バッチサイズ8: 180トークン/秒
- バッチサイズ32: 420トークン/秒
レイテンシ (ms)
LATENCY_PROFILE = {
"first_token": 42,
"token_throughput": {
"batch_1": 31.25,
"batch_8": 5.56,
"batch_32": 2.38
},
"context_scaling": {
"1024_tokens": 1.0,
"2048_tokens": 1.2,
"4096_tokens": 1.8
}
}
📚 ドキュメント
システム要件
最小構成
- CUDA 11.8+
- PyTorch 2.0+
- 16GB VRAM (INT8)
- 64GB RAM
- AVX2サポート
推奨構成
- CUDA 12.0+
- PyTorch 2.1+
- 24GB以上のVRAM
- 128GB RAM
- NVIDIA Ampere GPU
- NVMe SSD
📄 ライセンス
@software{hiber_multi_2024,
title = {Hiber-Multi-10B-Instruct: Advanced Multilingual Language Model},
author = {{Hibernates + UCLA Research Team}},
year = {2024},
publisher = {HuggingFace},
version = {1.0.0},
architecture = {Transformer},
parameters = {10B},
license = {LLaMA 3.1}
}