x5tne/playdate-dataset-4k
Viewer • Updated • 4.04k • 8
How to use x5tne/playdate-distilgpt2-5k with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="x5tne/playdate-distilgpt2-5k") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("x5tne/playdate-distilgpt2-5k")
model = AutoModelForMultimodalLM.from_pretrained("x5tne/playdate-distilgpt2-5k")How to use x5tne/playdate-distilgpt2-5k with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "x5tne/playdate-distilgpt2-5k"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "x5tne/playdate-distilgpt2-5k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/x5tne/playdate-distilgpt2-5k
How to use x5tne/playdate-distilgpt2-5k with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "x5tne/playdate-distilgpt2-5k" \
--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": "x5tne/playdate-distilgpt2-5k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "x5tne/playdate-distilgpt2-5k" \
--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": "x5tne/playdate-distilgpt2-5k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use x5tne/playdate-distilgpt2-5k with Docker Model Runner:
docker model run hf.co/x5tne/playdate-distilgpt2-5k
Expect this to be the last model based on DistilGPT2 as coherence has not advanced. Test model for newer personalities, not to be used in production. Script example below.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
MODEL_PATH = "x5tne/playdate-distilgpt2-5k"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
model = AutoModelForCausalLM.from_pretrained(MODEL_PATH)
model.eval()
# Example prompt
prompt = """<system harsh>
<summary>none</summary>
<user>Hi [namehere]! How are you today?</user>
<assistant>"""
# Encode input
inputs = tokenizer(prompt, return_tensors="pt")
# Generate output
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.9,
top_p=0.9,
repetition_penalty=1.15
)
# Decode generated tokens
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print("Assistant response:")
print(response)
Base model
distilbert/distilgpt2
docker model run hf.co/x5tne/playdate-distilgpt2-5k