grimulkan/LimaRP-augmented
Viewer • Updated • 804 • 86 • 33
How to use Aratako/calm3-22b-RP-v0.1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Aratako/calm3-22b-RP-v0.1")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Aratako/calm3-22b-RP-v0.1")
model = AutoModelForCausalLM.from_pretrained("Aratako/calm3-22b-RP-v0.1", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Aratako/calm3-22b-RP-v0.1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Aratako/calm3-22b-RP-v0.1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Aratako/calm3-22b-RP-v0.1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Aratako/calm3-22b-RP-v0.1
How to use Aratako/calm3-22b-RP-v0.1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Aratako/calm3-22b-RP-v0.1" \
--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": "Aratako/calm3-22b-RP-v0.1",
"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 "Aratako/calm3-22b-RP-v0.1" \
--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": "Aratako/calm3-22b-RP-v0.1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Aratako/calm3-22b-RP-v0.1 with Docker Model Runner:
docker model run hf.co/Aratako/calm3-22b-RP-v0.1
cyberagent/calm3-22b-chatをベースにロールプレイ用にQLoRAでファインチューニングしたモデルです。
Aratako/calm3-22b-RPの素材となるモデルとして利用しています。
元モデルから変更なく、ChatMLのフォーマットでご利用ください。以下は2ターン目の会話を行う際の形式です。
<|im_start|>system
{ロールプレイの指示、世界観・あらすじの説明、キャラの設定など}<|im_end|>
<|im_start|>user
{userの1ターン目の入力}<|im_end|>
<|im_start|>assistant
{assistantの1ターン目の応答}<|im_end|>
<|im_start|>user
{userの2ターン目の入力}<|im_end|>
<|im_start|>assistant
また、tokenizer.apply_chat_template()を使って自動で成形することも可能です。
tokenizer = AutoTokenizer.from_pretrained("Aratako/calm3-22b-RP-v0.1")
messages = [
{"role": "system", "content": "{ロールプレイの指示、世界観・あらすじの説明、キャラの設定など}"},
{"role": "user", "content": "{userの1ターン目の入力}"},
{"role": "assistant", "content": "{assistantの1ターン目の入力}"},
{"role": "user", "content": "{userの2ターン目の入力}"}
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
本モデルの学習には以下のデータセットを利用しています。
UnslothのQLoRAを用い、Runpod上のA10一枚で学習を行いました。主な学習パラメータは以下の通りです。
本モデルの学習データにはOpenAI社のGPT-4o-miniの出力やAnthropic社のClaude 3.5 Sonnetの出力が含まれるため、これらの競合となるサービスには本モデルは利用できません。 そのため、本モデルはCC-BY-NC-SA 4.0の元配布します。
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.