Instructions to use elliotthwang/phi_2_zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use elliotthwang/phi_2_zh with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="elliotthwang/phi_2_zh", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("elliotthwang/phi_2_zh", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("elliotthwang/phi_2_zh", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use elliotthwang/phi_2_zh with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "elliotthwang/phi_2_zh" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "elliotthwang/phi_2_zh", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/elliotthwang/phi_2_zh
- SGLang
How to use elliotthwang/phi_2_zh 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 "elliotthwang/phi_2_zh" \ --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": "elliotthwang/phi_2_zh", "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 "elliotthwang/phi_2_zh" \ --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": "elliotthwang/phi_2_zh", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use elliotthwang/phi_2_zh with Docker Model Runner:
docker model run hf.co/elliotthwang/phi_2_zh
Upload PhiForCausalLM
Browse files- config.json +1 -1
- model-00001-of-00002.safetensors +2 -2
- model-00002-of-00002.safetensors +2 -2
- model.safetensors.index.json +1 -1
config.json
CHANGED
|
@@ -30,5 +30,5 @@
|
|
| 30 |
"torch_dtype": "bfloat16",
|
| 31 |
"transformers_version": "4.39.0.dev0",
|
| 32 |
"use_cache": true,
|
| 33 |
-
"vocab_size":
|
| 34 |
}
|
|
|
|
| 30 |
"torch_dtype": "bfloat16",
|
| 31 |
"transformers_version": "4.39.0.dev0",
|
| 32 |
"use_cache": true,
|
| 33 |
+
"vocab_size": 51200
|
| 34 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d737474ab837039a9596551dd57b1c77b47101ea649722a3d28310335cc5f62
|
| 3 |
+
size 4995584848
|
model-00002-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0e912efeec2250754ca015aee38e0ba2e04b6b32b75c3f31b5ea9b7459fdf7c4
|
| 3 |
+
size 563833008
|
model.safetensors.index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
-
"total_size":
|
| 4 |
},
|
| 5 |
"weight_map": {
|
| 6 |
"lm_head.bias": "model-00002-of-00002.safetensors",
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_size": 5559367680
|
| 4 |
},
|
| 5 |
"weight_map": {
|
| 6 |
"lm_head.bias": "model-00002-of-00002.safetensors",
|