PygmalionAI/PIPPA
Updated • 867 • 263
How to use ludis/tsukasa-llama-3-8b-qlora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ludis/tsukasa-llama-3-8b-qlora")
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("ludis/tsukasa-llama-3-8b-qlora")
model = AutoModelForCausalLM.from_pretrained("ludis/tsukasa-llama-3-8b-qlora", 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 ludis/tsukasa-llama-3-8b-qlora with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ludis/tsukasa-llama-3-8b-qlora"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ludis/tsukasa-llama-3-8b-qlora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/ludis/tsukasa-llama-3-8b-qlora
How to use ludis/tsukasa-llama-3-8b-qlora with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ludis/tsukasa-llama-3-8b-qlora" \
--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": "ludis/tsukasa-llama-3-8b-qlora",
"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 "ludis/tsukasa-llama-3-8b-qlora" \
--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": "ludis/tsukasa-llama-3-8b-qlora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use ludis/tsukasa-llama-3-8b-qlora with Docker Model Runner:
docker model run hf.co/ludis/tsukasa-llama-3-8b-qlora
big thanks to lore for the 8xH100 gpus
base model is meta llama 3 8b instruct trained on pippa then i trained that model on limarp, both at 32k context for 2 epochs each
i would start with every sampler off and temperature at 1 and just make min p 0.05, i got good prompts from this but u can also try to gen settings from shori which are copy pasted below
use the llama 3 instruct format
<|eot_id|> as stopping sequence/string/token
agnaistic prompt:
<|begin_of_text|><|start_header_id|>system<|end_header_id|>{{#if system}}<|begin_of_text|><|start_header_id|>system<|end_header_id|>{{system}}<|eot_id|>{{/if}}Write {{char}}'s next reply in a fictional roleplay chat between {{#each bot}}{{.name}}, {{/each}}{{char}} and {{user}}.
{{char}}'s Persona: {{personality}}
{{#if memory}}
Important details:
{{memory}}
{{/if}}
{{#if example_dialogue}}This is how {{char}} should talk:
{{example_dialogue}}{{/if}}
This scenario of the conversation: {{scenario}}
Then the roleplay chat between {{#each bot}}{{.name}}, {{/each}}{{char}} and {{user}} begins.<|eot_id|>
{{#each msg}}{{#if .isbot}}<|start_header_id|>response<|end_header_id|>{{/if}}{{#if .isuser}}<|start_header_id|>user<|end_header_id|>{{/if}}{{.name}}: {{.msg}}<|eot_id|>
{{/each}}
{{#if ujb}}<|begin_of_text|><|start_header_id|>system<|end_header_id|>{{ujb}}<|eot_id|>{{/if}}
<|start_header_id|>response<|end_header_id|>{{post}}