HuggingFaceH4/ultrachat_200k
Viewer • Updated • 515k • 68.9k • 705
How to use ondevicellm/phi-1_5_sft with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ondevicellm/phi-1_5_sft", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ondevicellm/phi-1_5_sft", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("ondevicellm/phi-1_5_sft", trust_remote_code=True)
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 ondevicellm/phi-1_5_sft with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ondevicellm/phi-1_5_sft"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ondevicellm/phi-1_5_sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/ondevicellm/phi-1_5_sft
How to use ondevicellm/phi-1_5_sft with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ondevicellm/phi-1_5_sft" \
--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": "ondevicellm/phi-1_5_sft",
"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 "ondevicellm/phi-1_5_sft" \
--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": "ondevicellm/phi-1_5_sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use ondevicellm/phi-1_5_sft with Docker Model Runner:
docker model run hf.co/ondevicellm/phi-1_5_sft
This model is a fine-tuned version of microsoft/phi-1_5 on the HuggingFaceH4/ultrachat_200k dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.3099 | 0.1 | 100 | 1.3398 |
| 1.3131 | 0.2 | 200 | 1.3159 |
| 1.3009 | 0.3 | 300 | 1.3046 |
| 1.2915 | 0.4 | 400 | 1.2967 |
| 1.2714 | 0.5 | 500 | 1.2906 |
| 1.2811 | 0.6 | 600 | 1.2854 |
| 1.2621 | 0.7 | 700 | 1.2807 |
| 1.2406 | 0.8 | 800 | 1.2767 |
| 1.2371 | 0.9 | 900 | 1.2731 |
| 1.2547 | 1.0 | 1000 | 1.2699 |
| 1.2085 | 1.1 | 1100 | 1.2693 |
| 1.2253 | 1.2 | 1200 | 1.2669 |
| 1.215 | 1.3 | 1300 | 1.2649 |
| 1.2103 | 1.4 | 1400 | 1.2630 |
| 1.2081 | 1.5 | 1500 | 1.2612 |
| 1.2033 | 1.6 | 1600 | 1.2597 |
| 1.2307 | 1.7 | 1700 | 1.2582 |
| 1.2038 | 1.8 | 1800 | 1.2568 |
| 1.2014 | 1.9 | 1900 | 1.2557 |
| 1.188 | 2.0 | 2000 | 1.2546 |
| 1.1473 | 2.1 | 2100 | 1.2563 |
| 1.1872 | 2.2 | 2200 | 1.2559 |
| 1.2086 | 2.3 | 2300 | 1.2553 |
| 1.1896 | 2.4 | 2400 | 1.2550 |
| 1.1733 | 2.5 | 2500 | 1.2548 |
| 1.1665 | 2.6 | 2600 | 1.2544 |
| 1.1499 | 2.7 | 2700 | 1.2543 |
| 1.1779 | 2.8 | 2800 | 1.2542 |
| 1.1746 | 2.9 | 2900 | 1.2542 |
Base model
microsoft/phi-1_5