Instructions to use radames/phi-2-quantized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use radames/phi-2-quantized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="radames/phi-2-quantized", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("radames/phi-2-quantized", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use radames/phi-2-quantized with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "radames/phi-2-quantized" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "radames/phi-2-quantized", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/radames/phi-2-quantized
- SGLang
How to use radames/phi-2-quantized 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 "radames/phi-2-quantized" \ --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": "radames/phi-2-quantized", "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 "radames/phi-2-quantized" \ --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": "radames/phi-2-quantized", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use radames/phi-2-quantized with Docker Model Runner:
docker model run hf.co/radames/phi-2-quantized
first
Browse files- .gitattributes +1 -0
- config.json +33 -0
- model-v2-q4k.gguf +3 -0
- model-v2-q80.gguf +3 -0
- tokenizer.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.gguf filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "microsoft/phi-2",
|
| 3 |
+
"activation_function": "gelu",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"PhiForCausalLM"
|
| 6 |
+
],
|
| 7 |
+
"attn_pdrop": 0.0,
|
| 8 |
+
"auto_map": {
|
| 9 |
+
"AutoConfig": "configuration_phi.PhiConfig",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_phi.PhiForCausalLM"
|
| 11 |
+
},
|
| 12 |
+
"embd_pdrop": 0.0,
|
| 13 |
+
"flash_attn": false,
|
| 14 |
+
"flash_rotary": false,
|
| 15 |
+
"fused_dense": false,
|
| 16 |
+
"img_processor": null,
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"layer_norm_epsilon": 1e-05,
|
| 19 |
+
"model_type": "phi-msft",
|
| 20 |
+
"n_embd": 2560,
|
| 21 |
+
"n_head": 32,
|
| 22 |
+
"n_head_kv": null,
|
| 23 |
+
"n_inner": null,
|
| 24 |
+
"n_layer": 32,
|
| 25 |
+
"n_positions": 2048,
|
| 26 |
+
"resid_pdrop": 0.1,
|
| 27 |
+
"rotary_dim": 32,
|
| 28 |
+
"tie_word_embeddings": false,
|
| 29 |
+
"torch_dtype": "float16",
|
| 30 |
+
"transformers_version": "4.35.2",
|
| 31 |
+
"vocab_size": 51200,
|
| 32 |
+
"pad_vocab_size_multiple": 64
|
| 33 |
+
}
|
model-v2-q4k.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77971e348da4b424832a089f812ba50dec2bd633ae39d26b4f2c89c0ff3dea27
|
| 3 |
+
size 1566884768
|
model-v2-q80.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e649f0224baa9d12ca8f80956ffe62b5516832ae88551d3e7d40a6a4835efcf0
|
| 3 |
+
size 2956247968
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|