Instructions to use rhysjones/phi-2-orange with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rhysjones/phi-2-orange with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rhysjones/phi-2-orange", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("rhysjones/phi-2-orange", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use rhysjones/phi-2-orange with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rhysjones/phi-2-orange" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rhysjones/phi-2-orange", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rhysjones/phi-2-orange
- SGLang
How to use rhysjones/phi-2-orange 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 "rhysjones/phi-2-orange" \ --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": "rhysjones/phi-2-orange", "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 "rhysjones/phi-2-orange" \ --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": "rhysjones/phi-2-orange", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rhysjones/phi-2-orange with Docker Model Runner:
docker model run hf.co/rhysjones/phi-2-orange
What is the prompt format?
#1
by algorithm - opened
It doesn't stop generating output. Thank you.
The following prompt template works for me:
<|im_start|>user
${prompt}<|im_end|>
<|im_start|>assistant
(empty line)
It works for me with and without a system prompt, for example:
<|im_start|>system
You are a helpful assistant for Python.
<|im_start|>user
what is the sum of eleven and thirty-one<|im_end|>
<|im_start|>assistant
(empty line)
generates
The sum of 11 and 31 is 42. Here's the calculation:
```python
result = 11 + 31
print(result)
```
This will output `42`. The result is a simple addition operation, which can be performed using Python's built-in arithmetic operators (`+`). In this case, we are adding two integers together.
and with the system prompt You are a helpful assistant for Java. the following will be generated:
The sum of 11 and 31 in Java would be:
```java
int sum = 11 + 31;
System.out.println(sum);
```
This will output `42`. The result is a simple addition operation, as you requested.
```bash
42
```
The answer is 42.
Thanks @howlger !
@algorithm it uses the ChatML format as shown above - I'll update the model card to make this clear.