Instructions to use dphn/dolphin-2.6-mistral-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dphn/dolphin-2.6-mistral-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dphn/dolphin-2.6-mistral-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dphn/dolphin-2.6-mistral-7b") model = AutoModelForCausalLM.from_pretrained("dphn/dolphin-2.6-mistral-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use dphn/dolphin-2.6-mistral-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dphn/dolphin-2.6-mistral-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dphn/dolphin-2.6-mistral-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/dphn/dolphin-2.6-mistral-7b
- SGLang
How to use dphn/dolphin-2.6-mistral-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dphn/dolphin-2.6-mistral-7b" \ --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": "dphn/dolphin-2.6-mistral-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "dphn/dolphin-2.6-mistral-7b" \ --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": "dphn/dolphin-2.6-mistral-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use dphn/dolphin-2.6-mistral-7b with Docker Model Runner:
docker model run hf.co/dphn/dolphin-2.6-mistral-7b
Upload eval.sh with huggingface_hub
Browse files
eval.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
MODEL_PATH="/workspace/dolphin-2.6-mistral-7b-hf"
|
| 4 |
+
MODEL_NAME="dolphin-2.6-mistral-7b"
|
| 5 |
+
RESULTS_PATH="/workspace/results/$MODEL_NAME"
|
| 6 |
+
mkdir -p "$RESULTS_PATH"
|
| 7 |
+
|
| 8 |
+
PRETRAINED_ARGS="$MODEL_PATH,tensor_parallel_size=4,dtype=auto,trust_remote_code=True,gpu_memory_utilization=0.8"
|
| 9 |
+
MODEL_ARGS="pretrained=$PRETRAINED_ARGS"
|
| 10 |
+
|
| 11 |
+
tasks=(
|
| 12 |
+
# "mmlu"
|
| 13 |
+
# "truthfulqa"
|
| 14 |
+
"gsm8k"
|
| 15 |
+
"hellaswag"
|
| 16 |
+
"arc_challenge"
|
| 17 |
+
"winogrande")
|
| 18 |
+
|
| 19 |
+
# Function to get the number of fewshot for a given task
|
| 20 |
+
get_num_fewshot() {
|
| 21 |
+
case "$1" in
|
| 22 |
+
"mmlu") echo 5 ;;
|
| 23 |
+
"truthfulqa") echo 0 ;;
|
| 24 |
+
"gsm8k") echo 5 ;;
|
| 25 |
+
"hellaswag") echo 10 ;;
|
| 26 |
+
"arc_challenge") echo 25 ;;
|
| 27 |
+
"winogrande") echo 5 ;;
|
| 28 |
+
*) echo 0 ;;
|
| 29 |
+
esac
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
for TASK in "${tasks[@]}"; do
|
| 33 |
+
echo lm_eval --model vllm --model_args "$MODEL_ARGS" --task="$TASK" --num_fewshot "$(get_num_fewshot "$TASK")" --batch_size 8 --output_path "$RESULTS_PATH/$TASK.json"
|
| 34 |
+
lm_eval --model vllm --model_args "$MODEL_ARGS" --task="$TASK" --num_fewshot "$(get_num_fewshot "$TASK")" --batch_size 8 --output_path "$RESULTS_PATH/$TASK.json"
|
| 35 |
+
done
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
jq -s '[.[]]' $RESULTS_PATH/*.json > $RESULTS_PATH/eval_results.json
|
| 39 |
+
|
| 40 |
+
huggingface-cli upload cognitivecomputations/$MODEL_NAME $RESULTS_PATH/eval_results.json
|