databricks/databricks-dolly-15k
Viewer • Updated • 15k • 33.5k • 962
How to use HenryJJ/Instruct_Phi2_Dolly15K with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="HenryJJ/Instruct_Phi2_Dolly15K", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("HenryJJ/Instruct_Phi2_Dolly15K", trust_remote_code=True, dtype="auto")How to use HenryJJ/Instruct_Phi2_Dolly15K with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "HenryJJ/Instruct_Phi2_Dolly15K"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "HenryJJ/Instruct_Phi2_Dolly15K",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/HenryJJ/Instruct_Phi2_Dolly15K
How to use HenryJJ/Instruct_Phi2_Dolly15K with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "HenryJJ/Instruct_Phi2_Dolly15K" \
--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": "HenryJJ/Instruct_Phi2_Dolly15K",
"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 "HenryJJ/Instruct_Phi2_Dolly15K" \
--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": "HenryJJ/Instruct_Phi2_Dolly15K",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use HenryJJ/Instruct_Phi2_Dolly15K with Docker Model Runner:
docker model run hf.co/HenryJJ/Instruct_Phi2_Dolly15K
Fine-tuned from phi2,used Dolly15k for the dataset. 90% for training, 10% validation. Trained for 2.0 epochs using QLora. Trained with 1024 context window.
chatml format
<|im_start|>system
{instruction}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
<|im_start|>system
{instruction}<|im_end|>
<|im_start|>assistant
Fully opensourced at: https://github.com/hengjiUSTC/learn-llm/blob/main/trl_finetune.py. Run on 1 A10G instance for 4 hours.
python3 trl_finetune.py --config configs/phi2-dolly.yml