Instructions to use DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base") model = AutoModelForCausalLM.from_pretrained("DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base
- SGLang
How to use DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base with Docker Model Runner:
docker model run hf.co/DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base
How to use from
SGLangUse Docker images
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base" \
--host 0.0.0.0 \
--port 30000# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'Quick Links
Gemma モデル(スペシャルトークン拡張版)
概要
Gemmaは、Googleが開発した軽量かつ最先端のオープンモデルファミリーです。このモデルは、Geminiモデルと同じ研究および技術から生まれた英語対応のテキスト生成モデルです。事前学習版と指示調整版の両方のウェイトが公開されています。
このバージョンは、オリジナルのGemmaモデルに以下のスペシャルトークンを追加して拡張したものです:
<|SYSTEM|>,</|SYSTEM|>: システムメッセージの区切り<|USER|>,</|USER|>: ユーザー入力の区切り<|HINT|>,</|HINT|>: ヒント情報の区切り<|REASONING|>,</|REASONING|>: 推論過程の区切り<|ASSISTANT|>,</|ASSISTANT|>: アシスタント応答の区切り
モデルの特徴
- テキストからテキストを生成するデコーダーオンリーの大規模言語モデル
- 質問応答、要約、推論など、様々なテキスト生成タスクに適している
- ラップトップ、デスクトップ、または独自のクラウドインフラで展開可能な比較的小規模なサイズ
スペシャルトークンの使用例
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("your-model-path")
model = AutoModelForCausalLM.from_pretrained("your-model-path")
# スペシャルトークンを使用した入力の例
input_text = """<|SYSTEM|>あなたは親切なAIアシスタントです。</|SYSTEM|>
<|USER|>機械学習について説明してください。</|USER|>
<|ASSISTANT|>機械学習は..."""
input_ids = tokenizer(input_text, return_tensors="pt").to(device)
outputs = model.generate(**input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
モデルの仕様
- 9Bパラメータ版:8兆トークンで学習
使用方法
基本的な使用方法(Pipeline API)
import torch
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="google/gemma-2-9b",
device="cuda", # Macの場合は "mps" に置き換え
torch_dtype=torch.bfloat16 # BF16精度を指定
)
text = "<|SYSTEM|>You are a helpful assistant.</|SYSTEM|><|USER|>Tell me a story.</|USER|>"
outputs = pipe(text, max_new_tokens=256)
response = outputs[0]["generated_text"]
print(response)
- Downloads last month
- 4
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base" \ --host 0.0.0.0 \ --port 30000# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeL-TaiseiOzaki/Tengentoppa-gemma-2-9b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'