Instructions to use microsoft/Orca-2-13b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Orca-2-13b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/Orca-2-13b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/Orca-2-13b") model = AutoModelForCausalLM.from_pretrained("microsoft/Orca-2-13b") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use microsoft/Orca-2-13b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/Orca-2-13b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/Orca-2-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/Orca-2-13b
- SGLang
How to use microsoft/Orca-2-13b 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 "microsoft/Orca-2-13b" \ --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": "microsoft/Orca-2-13b", "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 "microsoft/Orca-2-13b" \ --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": "microsoft/Orca-2-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/Orca-2-13b with Docker Model Runner:
docker model run hf.co/microsoft/Orca-2-13b
Fp32 vs fp16
Thank you for contributing to this excellent model.
I have a question, the model is trained using float32 data type, but due to resource constraints, I am performing inference with fp16. Does this significantly impact the performance of the model?
Currently, I find it not performing as well as Orca 1 when inferring with fp16.
The model is trained with bfloat16. With fp16 inference you might see a loss, but overall that affects both Orca 1 and Orca 2. You can see the inference code here: https://huggingface.co/spaces/ari9dam/Orca-2-13B
(imp : use slow version of the tokenizer)
The model is trained with bfloat16. With fp16 inference you might see a loss, but overall that affects both Orca 1 and Orca 2. You can see the inference code here: https://huggingface.co/spaces/ari9dam/Orca-2-13B
(imp : use slow version of the tokenizer)
Thank you very much for your response.
As I see in the config.json file, Orca 2 used "torch_dtype": "float32", in the other hand, Orca 1 used "torch_dtype": "bfloat16". Adding one more thing, the total weight file size of Orca 1 is 26GB, while that of Orca 2 is 53GB. It implies that Orca 2 is storing weights in a data type that is twice the size of Orca 1. So I still do not quite understand your statement 'The model is trained with bfloat16.'.