Text Generation
Transformers
Safetensors
phi
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use rhysjones/phi-2-orange-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rhysjones/phi-2-orange-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rhysjones/phi-2-orange-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rhysjones/phi-2-orange-v2") model = AutoModelForCausalLM.from_pretrained("rhysjones/phi-2-orange-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rhysjones/phi-2-orange-v2 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-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rhysjones/phi-2-orange-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rhysjones/phi-2-orange-v2
- SGLang
How to use rhysjones/phi-2-orange-v2 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-v2" \ --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": "rhysjones/phi-2-orange-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-v2" \ --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": "rhysjones/phi-2-orange-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rhysjones/phi-2-orange-v2 with Docker Model Runner:
docker model run hf.co/rhysjones/phi-2-orange-v2
Update prompting suggestions
Browse files
README.md
CHANGED
|
@@ -11,6 +11,7 @@ datasets:
|
|
| 11 |
- argilla/ultrafeedback-binarized-preferences-cleaned
|
| 12 |
widget:
|
| 13 |
- example_title: "Example interaction"
|
|
|
|
| 14 |
text: "Why is the sky blue?"
|
| 15 |
model-index:
|
| 16 |
- name: phi-2-orange-v2
|
|
@@ -133,7 +134,7 @@ within Hugging Face's Transformers library (without the need for trust remote co
|
|
| 133 |
Phi-2 Orange v2 uses ChatML as the prompt format, with or without the system instruction.
|
| 134 |
(Update 12th March 2024: fixed eos_token issue)
|
| 135 |
|
| 136 |
-
|
| 137 |
|
| 138 |
```
|
| 139 |
<|im_start|>system
|
|
@@ -144,13 +145,14 @@ Write a function to calculate the Fibonacci sequence<|im_end|>
|
|
| 144 |
|
| 145 |
```
|
| 146 |
|
| 147 |
-
|
| 148 |
|
| 149 |
```
|
|
|
|
|
|
|
| 150 |
<|im_start|>user
|
| 151 |
-
|
| 152 |
<|im_start|>assistant
|
| 153 |
-
|
| 154 |
```
|
| 155 |
|
| 156 |
# Evaluations
|
|
|
|
| 11 |
- argilla/ultrafeedback-binarized-preferences-cleaned
|
| 12 |
widget:
|
| 13 |
- example_title: "Example interaction"
|
| 14 |
+
context: "You are a helpful assistant. Be short and direct in your answers."
|
| 15 |
text: "Why is the sky blue?"
|
| 16 |
model-index:
|
| 17 |
- name: phi-2-orange-v2
|
|
|
|
| 134 |
Phi-2 Orange v2 uses ChatML as the prompt format, with or without the system instruction.
|
| 135 |
(Update 12th March 2024: fixed eos_token issue)
|
| 136 |
|
| 137 |
+
It's recommended to always prompt with a system instruction (use whatever system prompt you like):
|
| 138 |
|
| 139 |
```
|
| 140 |
<|im_start|>system
|
|
|
|
| 145 |
|
| 146 |
```
|
| 147 |
|
| 148 |
+
For example, if you find the model's output to be overly verbose, instruct it to be short and concise:
|
| 149 |
|
| 150 |
```
|
| 151 |
+
<|im_start|>system
|
| 152 |
+
You are a helpful assistant. Be short and direct in your answers.<|im_end|>
|
| 153 |
<|im_start|>user
|
| 154 |
+
Was Tom Hanks in the movie Forrest Gump? If so, who did he play and give details of the plot.<|im_end|>
|
| 155 |
<|im_start|>assistant
|
|
|
|
| 156 |
```
|
| 157 |
|
| 158 |
# Evaluations
|