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 Settings
- 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
| MODEL_PATH="/workspace/dolphin-2.6-mistral-7b-hf" | |
| MODEL_NAME="dolphin-2.6-mistral-7b" | |
| RESULTS_PATH="/workspace/results/$MODEL_NAME" | |
| mkdir -p "$RESULTS_PATH" | |
| PRETRAINED_ARGS="$MODEL_PATH,tensor_parallel_size=4,dtype=auto,trust_remote_code=True,gpu_memory_utilization=0.8" | |
| MODEL_ARGS="pretrained=$PRETRAINED_ARGS" | |
| tasks=( | |
| # "mmlu" | |
| # "truthfulqa" | |
| "gsm8k" | |
| "hellaswag" | |
| "arc_challenge" | |
| "winogrande") | |
| # Function to get the number of fewshot for a given task | |
| get_num_fewshot() { | |
| case "$1" in | |
| "mmlu") echo 5 ;; | |
| "truthfulqa") echo 0 ;; | |
| "gsm8k") echo 5 ;; | |
| "hellaswag") echo 10 ;; | |
| "arc_challenge") echo 25 ;; | |
| "winogrande") echo 5 ;; | |
| *) echo 0 ;; | |
| esac | |
| } | |
| for TASK in "${tasks[@]}"; do | |
| 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" | |
| 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" | |
| done | |
| jq -s '[.[]]' $RESULTS_PATH/*.json > $RESULTS_PATH/eval_results.json | |
| huggingface-cli upload cognitivecomputations/$MODEL_NAME $RESULTS_PATH/eval_results.json |