Text Generation
Transformers
PyTorch
ExecuTorch
multilingual
phi3
torchao
phi
phi4
nlp
code
math
chat
conversational
custom_code
text-generation-inference
Instructions to use pytorch/Phi-4-mini-instruct-parq-2w-4e-shared with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pytorch/Phi-4-mini-instruct-parq-2w-4e-shared with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", trust_remote_code=True) 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pytorch/Phi-4-mini-instruct-parq-2w-4e-shared with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pytorch/Phi-4-mini-instruct-parq-2w-4e-shared
- SGLang
How to use pytorch/Phi-4-mini-instruct-parq-2w-4e-shared 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 "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared" \ --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": "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", "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 "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared" \ --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": "pytorch/Phi-4-mini-instruct-parq-2w-4e-shared", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pytorch/Phi-4-mini-instruct-parq-2w-4e-shared with Docker Model Runner:
docker model run hf.co/pytorch/Phi-4-mini-instruct-parq-2w-4e-shared
Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- config.json +27 -11
- training_args.bin +0 -0
.gitattributes
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
config.json
CHANGED
|
@@ -129,25 +129,41 @@
|
|
| 129 |
},
|
| 130 |
"model.embed_tokens": {
|
| 131 |
"_data": {
|
| 132 |
-
"
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
"_data": {
|
| 136 |
"axis": 0
|
| 137 |
},
|
| 138 |
"_type": "PerAxis",
|
| 139 |
"_version": 1
|
| 140 |
},
|
| 141 |
-
"
|
| 142 |
-
"_data":
|
| 143 |
-
"_type": "
|
| 144 |
-
"_version": 1
|
| 145 |
},
|
| 146 |
-
"
|
| 147 |
-
"quant_min": -1.5,
|
| 148 |
-
"scale_dtype": null
|
| 149 |
},
|
| 150 |
-
"_type": "
|
| 151 |
"_version": 2
|
| 152 |
}
|
| 153 |
}
|
|
|
|
| 129 |
},
|
| 130 |
"model.embed_tokens": {
|
| 131 |
"_data": {
|
| 132 |
+
"act_mapping_type": {
|
| 133 |
+
"_data": "ASYMMETRIC",
|
| 134 |
+
"_type": "MappingType"
|
| 135 |
+
},
|
| 136 |
+
"intx_choose_qparams_algorithm": {
|
| 137 |
+
"_data": "AFFINE",
|
| 138 |
+
"_type": "IntxChooseQParamsAlgorithm"
|
| 139 |
+
},
|
| 140 |
+
"intx_packing_format": {
|
| 141 |
+
"_data": "UNPACKED_TO_INT8",
|
| 142 |
+
"_type": "IntxPackingFormat"
|
| 143 |
+
},
|
| 144 |
+
"layout": {
|
| 145 |
+
"_data": {},
|
| 146 |
+
"_type": "QDQLayout",
|
| 147 |
+
"_version": 1
|
| 148 |
+
},
|
| 149 |
+
"weight_dtype": {
|
| 150 |
+
"_data": "int4",
|
| 151 |
+
"_type": "torch.dtype"
|
| 152 |
+
},
|
| 153 |
+
"weight_granularity": {
|
| 154 |
"_data": {
|
| 155 |
"axis": 0
|
| 156 |
},
|
| 157 |
"_type": "PerAxis",
|
| 158 |
"_version": 1
|
| 159 |
},
|
| 160 |
+
"weight_mapping_type": {
|
| 161 |
+
"_data": "SYMMETRIC",
|
| 162 |
+
"_type": "MappingType"
|
|
|
|
| 163 |
},
|
| 164 |
+
"weight_scale_dtype": null
|
|
|
|
|
|
|
| 165 |
},
|
| 166 |
+
"_type": "Int8DynamicActivationIntxWeightConfig",
|
| 167 |
"_version": 2
|
| 168 |
}
|
| 169 |
}
|
training_args.bin
CHANGED
|
Binary files a/training_args.bin and b/training_args.bin differ
|
|
|