garage-bAInd/Open-Platypus
Viewer β’ Updated β’ 24.9k β’ 9.93k β’ 417
How to use lodrick-the-lafted/Platyboros-Instruct-7B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="lodrick-the-lafted/Platyboros-Instruct-7B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("lodrick-the-lafted/Platyboros-Instruct-7B")
model = AutoModelForCausalLM.from_pretrained("lodrick-the-lafted/Platyboros-Instruct-7B")
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use lodrick-the-lafted/Platyboros-Instruct-7B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "lodrick-the-lafted/Platyboros-Instruct-7B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lodrick-the-lafted/Platyboros-Instruct-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/lodrick-the-lafted/Platyboros-Instruct-7B
How to use lodrick-the-lafted/Platyboros-Instruct-7B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "lodrick-the-lafted/Platyboros-Instruct-7B" \
--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": "lodrick-the-lafted/Platyboros-Instruct-7B",
"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 "lodrick-the-lafted/Platyboros-Instruct-7B" \
--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": "lodrick-the-lafted/Platyboros-Instruct-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use lodrick-the-lafted/Platyboros-Instruct-7B with Docker Model Runner:
docker model run hf.co/lodrick-the-lafted/Platyboros-Instruct-7B
Mistral-7B-Instruct-v0.2 trained with jondurbin/airoboros-3.2 and garage-bAInd/Open-Platypus, in Alpaca format.
Both the default Mistral-Instruct tags and Alpaca are fine, so either:
<s>[INST] {sys_prompt} {instruction} [/INST]
or
{sys_prompt}
### Instruction:
{instruction}
### Response:
The tokenizer default is Alpaca this time around.
from transformers import AutoTokenizer
import transformers
import torch
model = "lodrick-the-lafted/Platyboros-Instruct-7B"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
model_kwargs={"torch_dtype": torch.bfloat16},
)
messages = [{"role": "user", "content": "Give me a cooking recipe for an apple pie."}]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.95)
print(outputs[0]["generated_text"])
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 64.19 |
| AI2 Reasoning Challenge (25-Shot) | 57.76 |
| HellaSwag (10-Shot) | 82.59 |
| MMLU (5-Shot) | 62.05 |
| TruthfulQA (0-shot) | 60.92 |
| Winogrande (5-shot) | 78.14 |
| GSM8k (5-shot) | 43.67 |