Text Generation
Transformers
Safetensors
phi
Generated from Trainer
custom_code
text-generation-inference
Instructions to use teddy-f-47/phi-pl-2_7B-v_0_1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "teddy-f-47/phi-pl-2_7B-v_0_1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teddy-f-47/phi-pl-2_7B-v_0_1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/teddy-f-47/phi-pl-2_7B-v_0_1
- SGLang
How to use teddy-f-47/phi-pl-2_7B-v_0_1 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 "teddy-f-47/phi-pl-2_7B-v_0_1" \ --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": "teddy-f-47/phi-pl-2_7B-v_0_1", "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 "teddy-f-47/phi-pl-2_7B-v_0_1" \ --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": "teddy-f-47/phi-pl-2_7B-v_0_1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with Docker Model Runner:
docker model run hf.co/teddy-f-47/phi-pl-2_7B-v_0_1
Update configuration_phi.py
Browse files- configuration_phi.py +9 -9
configuration_phi.py
CHANGED
|
@@ -116,13 +116,13 @@ class PhiConfig(PretrainedConfig):
|
|
| 116 |
|
| 117 |
def __init__(
|
| 118 |
self,
|
| 119 |
-
vocab_size=
|
| 120 |
-
hidden_size=
|
| 121 |
-
intermediate_size=
|
| 122 |
-
num_hidden_layers=
|
| 123 |
num_attention_heads=32,
|
| 124 |
-
num_key_value_heads=
|
| 125 |
-
resid_pdrop=0.
|
| 126 |
embd_pdrop=0.0,
|
| 127 |
attention_dropout=0.0,
|
| 128 |
hidden_act="gelu_new",
|
|
@@ -133,10 +133,10 @@ class PhiConfig(PretrainedConfig):
|
|
| 133 |
tie_word_embeddings=False,
|
| 134 |
rope_theta=10000.0,
|
| 135 |
rope_scaling=None,
|
| 136 |
-
partial_rotary_factor=0.
|
| 137 |
qk_layernorm=False,
|
| 138 |
-
bos_token_id=
|
| 139 |
-
eos_token_id=
|
| 140 |
**kwargs,
|
| 141 |
):
|
| 142 |
self.vocab_size = vocab_size
|
|
|
|
| 116 |
|
| 117 |
def __init__(
|
| 118 |
self,
|
| 119 |
+
vocab_size=50295,
|
| 120 |
+
hidden_size=2560,
|
| 121 |
+
intermediate_size=10240,
|
| 122 |
+
num_hidden_layers=32,
|
| 123 |
num_attention_heads=32,
|
| 124 |
+
num_key_value_heads=32,
|
| 125 |
+
resid_pdrop=0.1,
|
| 126 |
embd_pdrop=0.0,
|
| 127 |
attention_dropout=0.0,
|
| 128 |
hidden_act="gelu_new",
|
|
|
|
| 133 |
tie_word_embeddings=False,
|
| 134 |
rope_theta=10000.0,
|
| 135 |
rope_scaling=None,
|
| 136 |
+
partial_rotary_factor=0.4,
|
| 137 |
qk_layernorm=False,
|
| 138 |
+
bos_token_id=0,
|
| 139 |
+
eos_token_id=0,
|
| 140 |
**kwargs,
|
| 141 |
):
|
| 142 |
self.vocab_size = vocab_size
|