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 +2 -2
- generation_config.json +1 -1
- model-00001-of-00002.safetensors +1 -1
- model-00002-of-00002.safetensors +1 -1
config.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
},
|
| 11 |
"bos_token_id": 50256,
|
| 12 |
"embd_pdrop": 0.0,
|
| 13 |
-
"eos_token_id":
|
| 14 |
"hidden_act": "gelu_new",
|
| 15 |
"hidden_size": 2560,
|
| 16 |
"initializer_range": 0.02,
|
|
@@ -28,7 +28,7 @@
|
|
| 28 |
"rope_theta": 10000.0,
|
| 29 |
"tie_word_embeddings": false,
|
| 30 |
"torch_dtype": "bfloat16",
|
| 31 |
-
"transformers_version": "4.
|
| 32 |
"use_cache": true,
|
| 33 |
"vocab_size": 50297
|
| 34 |
}
|
|
|
|
| 10 |
},
|
| 11 |
"bos_token_id": 50256,
|
| 12 |
"embd_pdrop": 0.0,
|
| 13 |
+
"eos_token_id": 50256,
|
| 14 |
"hidden_act": "gelu_new",
|
| 15 |
"hidden_size": 2560,
|
| 16 |
"initializer_range": 0.02,
|
|
|
|
| 28 |
"rope_theta": 10000.0,
|
| 29 |
"tie_word_embeddings": false,
|
| 30 |
"torch_dtype": "bfloat16",
|
| 31 |
+
"transformers_version": "4.39.0.dev0",
|
| 32 |
"use_cache": true,
|
| 33 |
"vocab_size": 50297
|
| 34 |
}
|
generation_config.json
CHANGED
|
@@ -2,5 +2,5 @@
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 50256,
|
| 4 |
"eos_token_id": 50256,
|
| 5 |
-
"transformers_version": "4.
|
| 6 |
}
|
|
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 50256,
|
| 4 |
"eos_token_id": 50256,
|
| 5 |
+
"transformers_version": "4.39.0.dev0"
|
| 6 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4990961488
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b100bebed49c10a7a6a1c1dc0f410795b416e39610a78a3c91a9708ec8ecdd7
|
| 3 |
size 4990961488
|
model-00002-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 559207842
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f97c1f713c23195c161089db483ca0dc400cbe85af2f723f9a7aaacd1966ba6
|
| 3 |
size 559207842
|