hotchpotch/fineweb-2-edu-japanese
Viewer • Updated • 262M • 2.95k • 32
How to use kurogane/Nemotron-H-micro-test03 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="kurogane/Nemotron-H-micro-test03")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("kurogane/Nemotron-H-micro-test03", dtype="auto")How to use kurogane/Nemotron-H-micro-test03 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "kurogane/Nemotron-H-micro-test03"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "kurogane/Nemotron-H-micro-test03",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/kurogane/Nemotron-H-micro-test03
How to use kurogane/Nemotron-H-micro-test03 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "kurogane/Nemotron-H-micro-test03" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "kurogane/Nemotron-H-micro-test03",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "kurogane/Nemotron-H-micro-test03" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "kurogane/Nemotron-H-micro-test03",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use kurogane/Nemotron-H-micro-test03 with Docker Model Runner:
docker model run hf.co/kurogane/Nemotron-H-micro-test03
Configuration Parsing Warning:Invalid JSON for config file config.json
NemotronHアーキテクチャのBaseモデルです。 動作確認用に小規模データセットでトレーニングしたものです。 context sizeは512です。
hotchpotch/fineweb-2-edu-japaneseの1%のデータを含むデータセットで19 epochs回しました。
Rakuten/RakutenAI-2.0-mini-instructを使用しました。 日本語対応LLMであり、vocab_sizeが48000と学習に使いやすそうだったからです。
chat templateは搭載していますが、全くチャット形式に対応していないので通常のテキスト生成飲みが可能です。
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "kurogane/Nemotron-H-micro-test03"
dir_cache = r"/media/kurogane/backup/cache"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
cache_dir=dir_cache,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
cache_dir=dir_cache,
)
inputs = tokenizer(
"こんにちは",
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs)
print(
tokenizer.batch_decode(
outputs,
skip_special_tokens=True,
)
)
こんにちは!\n今回は、「教えて、お願い!」という方向けに、\n