Instructions to use tiny-random/phi-3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/phi-3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/phi-3") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiny-random/phi-3") model = AutoModelForCausalLM.from_pretrained("tiny-random/phi-3", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/phi-3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/phi-3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/phi-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiny-random/phi-3
- SGLang
How to use tiny-random/phi-3 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 "tiny-random/phi-3" \ --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": "tiny-random/phi-3", "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 "tiny-random/phi-3" \ --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": "tiny-random/phi-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiny-random/phi-3 with Docker Model Runner:
docker model run hf.co/tiny-random/phi-3
Upload folder using huggingface_hub
Browse files- .meta/create_model.py +56 -0
- .meta/env.json +45 -0
- .meta/model.log +25 -0
- LICENSE +22 -0
- README.md +91 -0
- added_tokens.json +13 -0
- config.json +70 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +130 -0
.meta/create_model.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def create_model(source_model_id: str, source_revision: str, save_folder: str) -> str:
|
| 2 |
+
import json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
import torch
|
| 6 |
+
from huggingface_hub import hf_hub_download
|
| 7 |
+
from transformers import AutoConfig, AutoModelForCausalLM, set_seed
|
| 8 |
+
|
| 9 |
+
folder = Path(save_folder)
|
| 10 |
+
folder.mkdir(parents=True, exist_ok=True)
|
| 11 |
+
for name in (
|
| 12 |
+
"added_tokens.json",
|
| 13 |
+
"special_tokens_map.json",
|
| 14 |
+
"tokenizer.json",
|
| 15 |
+
"tokenizer.model",
|
| 16 |
+
"tokenizer_config.json",
|
| 17 |
+
"generation_config.json",
|
| 18 |
+
"LICENSE",
|
| 19 |
+
):
|
| 20 |
+
(folder / name).write_bytes(Path(hf_hub_download(source_model_id, name, revision=source_revision)).read_bytes())
|
| 21 |
+
|
| 22 |
+
config = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
|
| 23 |
+
# Source MLP ratio 8192/3072 = 2.667; 352 keeps 2.75 and divides by 4.
|
| 24 |
+
config.update(
|
| 25 |
+
hidden_size=128,
|
| 26 |
+
intermediate_size=352,
|
| 27 |
+
num_hidden_layers=4,
|
| 28 |
+
num_attention_heads=4,
|
| 29 |
+
num_key_value_heads=4,
|
| 30 |
+
)
|
| 31 |
+
# LongRoPE factors are one per rotary dimension pair: source head_dim 96 ->
|
| 32 |
+
# 48 factors; tiny head_dim 32 -> 16. Truncate both lists to the new count.
|
| 33 |
+
rope_scaling = config.get("rope_scaling")
|
| 34 |
+
if isinstance(rope_scaling, dict):
|
| 35 |
+
for key in ("short_factor", "long_factor"):
|
| 36 |
+
if key in rope_scaling:
|
| 37 |
+
rope_scaling[key] = rope_scaling[key][:16]
|
| 38 |
+
config.pop("auto_map", None)
|
| 39 |
+
(folder / "config.json").write_text(json.dumps(config, indent=2) + "\n")
|
| 40 |
+
|
| 41 |
+
set_seed(42)
|
| 42 |
+
model = AutoModelForCausalLM.from_config(AutoConfig.from_pretrained(folder), dtype=torch.bfloat16)
|
| 43 |
+
model.save_pretrained(folder)
|
| 44 |
+
(folder / "config.json").write_text(json.dumps(config, indent=2) + "\n")
|
| 45 |
+
(folder / "generation_config.json").write_bytes(
|
| 46 |
+
Path(hf_hub_download(source_model_id, "generation_config.json", revision=source_revision)).read_bytes()
|
| 47 |
+
)
|
| 48 |
+
return str(model)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
create_model(
|
| 53 |
+
source_model_id="microsoft/Phi-3-mini-128k-instruct",
|
| 54 |
+
source_revision="f3c06aed622e14ca0abf5115094e4fc9a9948f36",
|
| 55 |
+
save_folder="/tmp/phi-3",
|
| 56 |
+
)
|
.meta/env.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_model": {
|
| 3 |
+
"name": "microsoft/Phi-3-mini-128k-instruct",
|
| 4 |
+
"commit_id": "f3c06aed622e14ca0abf5115094e4fc9a9948f36"
|
| 5 |
+
},
|
| 6 |
+
"environments": {
|
| 7 |
+
"creation": {
|
| 8 |
+
"python": "3.12.13",
|
| 9 |
+
"packages": {
|
| 10 |
+
"huggingface_hub": "2.3.0",
|
| 11 |
+
"safetensors": "0.8.0",
|
| 12 |
+
"tokenizers": "0.23.3",
|
| 13 |
+
"torch": "2.13.0+cu126",
|
| 14 |
+
"transformers": "5.22.0.dev0"
|
| 15 |
+
},
|
| 16 |
+
"cuda": "12.6"
|
| 17 |
+
},
|
| 18 |
+
"sglang": {
|
| 19 |
+
"python": "3.12.13",
|
| 20 |
+
"packages": {
|
| 21 |
+
"torch": "2.9.1+cu126",
|
| 22 |
+
"transformers": "5.3.0",
|
| 23 |
+
"sglang": "0.5.10"
|
| 24 |
+
},
|
| 25 |
+
"cuda": "12.6",
|
| 26 |
+
"hardware": {
|
| 27 |
+
"gpu_model": "NVIDIA H20"
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"transformers": {
|
| 31 |
+
"python": "3.12.13",
|
| 32 |
+
"packages": {
|
| 33 |
+
"huggingface_hub": "2.3.0",
|
| 34 |
+
"safetensors": "0.8.0",
|
| 35 |
+
"tokenizers": "0.23.3",
|
| 36 |
+
"torch": "2.13.0+cu126",
|
| 37 |
+
"transformers": "5.22.0.dev0"
|
| 38 |
+
},
|
| 39 |
+
"cuda": "12.6",
|
| 40 |
+
"hardware": {
|
| 41 |
+
"gpu_model": "NVIDIA H20"
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
.meta/model.log
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Phi3ForCausalLM(
|
| 2 |
+
(model): Phi3Model(
|
| 3 |
+
(embed_tokens): Embedding(32064, 128, padding_idx=32000)
|
| 4 |
+
(layers): ModuleList(
|
| 5 |
+
(0-3): 4 x Phi3DecoderLayer(
|
| 6 |
+
(self_attn): Phi3Attention(
|
| 7 |
+
(o_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 8 |
+
(qkv_proj): Linear(in_features=128, out_features=384, bias=False)
|
| 9 |
+
)
|
| 10 |
+
(mlp): Phi3MLP(
|
| 11 |
+
(gate_up_proj): Linear(in_features=128, out_features=704, bias=False)
|
| 12 |
+
(down_proj): Linear(in_features=352, out_features=128, bias=False)
|
| 13 |
+
(activation_fn): SiLUActivation()
|
| 14 |
+
)
|
| 15 |
+
(input_layernorm): Phi3RMSNorm((128,), eps=1e-05)
|
| 16 |
+
(post_attention_layernorm): Phi3RMSNorm((128,), eps=1e-05)
|
| 17 |
+
(resid_attn_dropout): Dropout(p=0.0, inplace=False)
|
| 18 |
+
(resid_mlp_dropout): Dropout(p=0.0, inplace=False)
|
| 19 |
+
)
|
| 20 |
+
)
|
| 21 |
+
(norm): Phi3RMSNorm((128,), eps=1e-05)
|
| 22 |
+
(rotary_emb): Phi3RotaryEmbedding()
|
| 23 |
+
)
|
| 24 |
+
(lm_head): Linear(in_features=128, out_features=32064, bias=False)
|
| 25 |
+
)
|
LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Microsoft.
|
| 2 |
+
Copyright (c) Microsoft Corporation.
|
| 3 |
+
|
| 4 |
+
MIT License
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 7 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 8 |
+
in the Software without restriction, including without limitation the rights
|
| 9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 10 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 11 |
+
furnished to do so, subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included in all
|
| 14 |
+
copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 22 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
base_model:
|
| 5 |
+
- microsoft/Phi-3-mini-128k-instruct
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
This is a randomly initialized tiny model based on [microsoft/Phi-3-mini-128k-instruct](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct) for testing and debugging.
|
| 9 |
+
|
| 10 |
+
| Feature | Source | This repo |
|
| 11 |
+
|---|---|---|
|
| 12 |
+
| Checkpoint tensor elements | 3.82B BF16 | 9.01M BF16 |
|
| 13 |
+
| Safetensors weight files | 7.64 GB (2 files) | 18.03 MB (model.safetensors) |
|
| 14 |
+
| Layers | 32 | 4 |
|
| 15 |
+
| Hidden width / MLP width | 3,072 / 8,192 (2.67x) | 128 / 352 (2.75x) |
|
| 16 |
+
| Q heads / KV heads / head_dim | 32 / 32 / 96 | 4 / 4 / 32 |
|
| 17 |
+
| Sliding window | 262,144 | Same |
|
| 18 |
+
| Vocabulary rows / embedding tying / biases | 32,064 / untied / no attn bias | Same |
|
| 19 |
+
| Stored precision | BF16 | Same |
|
| 20 |
+
|
| 21 |
+
| File path | Size |
|
| 22 |
+
|------|------|
|
| 23 |
+
| model.safetensors | 18.0MB |
|
| 24 |
+
|
| 25 |
+
### Example usage
|
| 26 |
+
|
| 27 |
+
#### Transformers (✅ verified)
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
def run_transformers(model_id: str):
|
| 31 |
+
import torch
|
| 32 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 33 |
+
|
| 34 |
+
model_id = str(model_id)
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 36 |
+
model = (
|
| 37 |
+
AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, attn_implementation="sdpa").eval().cuda()
|
| 38 |
+
)
|
| 39 |
+
prompt = tokenizer.apply_chat_template(
|
| 40 |
+
[{"role": "user", "content": "Tell me a joke."}],
|
| 41 |
+
tokenize=False,
|
| 42 |
+
add_generation_prompt=True,
|
| 43 |
+
)
|
| 44 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 45 |
+
with torch.no_grad():
|
| 46 |
+
assert torch.isfinite(model(**inputs).logits).all()
|
| 47 |
+
output = model.generate(**inputs, do_sample=False, max_new_tokens=8)
|
| 48 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
run_transformers(model_id="tiny-random/phi-3")
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
#### SGLang (✅ verified)
|
| 56 |
+
|
| 57 |
+
SGLang 0.5.10 ships a native `Phi3ForCausalLM` implementation; serve the tiny checkpoint with tensor parallelism:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
sglang serve --model-path tiny-random/phi-3 --tp 4 \
|
| 61 |
+
--dtype bfloat16 --context-length 1024 --disable-piecewise-cuda-graph --host 0.0.0.0 --port 30000
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
piecewise prefill CUDA graph capture hits `CUBLAS_STATUS_INTERNAL_ERROR` in `o_proj`, so the command below passes `--disable-piecewise-cuda-graph`.
|
| 65 |
+
|
| 66 |
+
Send an OpenAI chat request:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from openai import OpenAI
|
| 70 |
+
|
| 71 |
+
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
|
| 72 |
+
resp = client.chat.completions.create(
|
| 73 |
+
model="tiny-random/phi-3",
|
| 74 |
+
messages=[{"role": "user", "content": "Hello"}],
|
| 75 |
+
max_tokens=8,
|
| 76 |
+
temperature=0,
|
| 77 |
+
)
|
| 78 |
+
print(resp.choices[0].message.content)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### Creating this repo
|
| 82 |
+
|
| 83 |
+
- Code: [.meta/create_model.py](.meta/create_model.py)
|
| 84 |
+
- Model structure: [.meta/model.log](.meta/model.log)
|
| 85 |
+
- Environment: [.meta/env.json](.meta/env.json)
|
| 86 |
+
|
| 87 |
+
### Change log
|
| 88 |
+
|
| 89 |
+
- 2026-11-07: Initial version rebuilt from the official microsoft/Phi-3-mini-128k-instruct source with four layers.
|
| 90 |
+
|
| 91 |
+
*This repo is generated by GPT-6.1-Sol.*
|
added_tokens.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<|endoftext|>": 32000,
|
| 3 |
+
"<|assistant|>": 32001,
|
| 4 |
+
"<|placeholder1|>": 32002,
|
| 5 |
+
"<|placeholder2|>": 32003,
|
| 6 |
+
"<|placeholder3|>": 32004,
|
| 7 |
+
"<|placeholder4|>": 32005,
|
| 8 |
+
"<|system|>": 32006,
|
| 9 |
+
"<|end|>": 32007,
|
| 10 |
+
"<|placeholder5|>": 32008,
|
| 11 |
+
"<|placeholder6|>": 32009,
|
| 12 |
+
"<|user|>": 32010
|
| 13 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "Phi-3-mini-128k-instruct",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Phi3ForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"embd_pdrop": 0.0,
|
| 9 |
+
"eos_token_id": 32000,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 128,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 352,
|
| 14 |
+
"max_position_embeddings": 131072,
|
| 15 |
+
"model_type": "phi3",
|
| 16 |
+
"num_attention_heads": 4,
|
| 17 |
+
"num_hidden_layers": 4,
|
| 18 |
+
"num_key_value_heads": 4,
|
| 19 |
+
"original_max_position_embeddings": 4096,
|
| 20 |
+
"pad_token_id": 32000,
|
| 21 |
+
"resid_pdrop": 0.0,
|
| 22 |
+
"rms_norm_eps": 1e-05,
|
| 23 |
+
"rope_scaling": {
|
| 24 |
+
"long_factor": [
|
| 25 |
+
1.0700000524520874,
|
| 26 |
+
1.1200000047683716,
|
| 27 |
+
1.149999976158142,
|
| 28 |
+
1.4199999570846558,
|
| 29 |
+
1.5699999332427979,
|
| 30 |
+
1.7999999523162842,
|
| 31 |
+
2.129999876022339,
|
| 32 |
+
2.129999876022339,
|
| 33 |
+
3.009999990463257,
|
| 34 |
+
5.910000324249268,
|
| 35 |
+
6.950000286102295,
|
| 36 |
+
9.070000648498535,
|
| 37 |
+
9.930000305175781,
|
| 38 |
+
10.710000038146973,
|
| 39 |
+
11.130000114440918,
|
| 40 |
+
14.609999656677246
|
| 41 |
+
],
|
| 42 |
+
"short_factor": [
|
| 43 |
+
1.1,
|
| 44 |
+
1.1,
|
| 45 |
+
1.1,
|
| 46 |
+
1.3000000000000003,
|
| 47 |
+
1.3500000000000003,
|
| 48 |
+
1.3500000000000003,
|
| 49 |
+
1.4000000000000004,
|
| 50 |
+
1.5500000000000005,
|
| 51 |
+
2.000000000000001,
|
| 52 |
+
2.000000000000001,
|
| 53 |
+
2.000000000000001,
|
| 54 |
+
2.000000000000001,
|
| 55 |
+
2.000000000000001,
|
| 56 |
+
2.000000000000001,
|
| 57 |
+
2.000000000000001,
|
| 58 |
+
2.000000000000001
|
| 59 |
+
],
|
| 60 |
+
"type": "longrope"
|
| 61 |
+
},
|
| 62 |
+
"rope_theta": 10000.0,
|
| 63 |
+
"sliding_window": 262144,
|
| 64 |
+
"tie_word_embeddings": false,
|
| 65 |
+
"torch_dtype": "bfloat16",
|
| 66 |
+
"transformers_version": "4.40.2",
|
| 67 |
+
"use_cache": true,
|
| 68 |
+
"attention_bias": false,
|
| 69 |
+
"vocab_size": 32064
|
| 70 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
32000,
|
| 6 |
+
32001,
|
| 7 |
+
32007
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 32000,
|
| 10 |
+
"transformers_version": "4.41.2"
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd695f03a62aa48abe20c4480b2f70dc62e839ad4c64143bdd05bde608f5628d
|
| 3 |
+
size 18027672
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|endoftext|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<|endoftext|>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<s>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "</s>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": true,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": false
|
| 28 |
+
},
|
| 29 |
+
"32000": {
|
| 30 |
+
"content": "<|endoftext|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"32001": {
|
| 38 |
+
"content": "<|assistant|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": true,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"32002": {
|
| 46 |
+
"content": "<|placeholder1|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": true,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"32003": {
|
| 54 |
+
"content": "<|placeholder2|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": true,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"32004": {
|
| 62 |
+
"content": "<|placeholder3|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": true,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"32005": {
|
| 70 |
+
"content": "<|placeholder4|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": true,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"32006": {
|
| 78 |
+
"content": "<|system|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": true,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"32007": {
|
| 86 |
+
"content": "<|end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": true,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"32008": {
|
| 94 |
+
"content": "<|placeholder5|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": true,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"32009": {
|
| 102 |
+
"content": "<|placeholder6|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": true,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"32010": {
|
| 110 |
+
"content": "<|user|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": true,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
"bos_token": "<s>",
|
| 119 |
+
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}{{'<|system|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'user' %}{{'<|user|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'assistant' %}{{'<|assistant|>\n' + message['content'] + '<|end|>\n'}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>\n' }}{% else %}{{ eos_token }}{% endif %}",
|
| 120 |
+
"clean_up_tokenization_spaces": false,
|
| 121 |
+
"eos_token": "<|endoftext|>",
|
| 122 |
+
"legacy": false,
|
| 123 |
+
"model_max_length": 131072,
|
| 124 |
+
"pad_token": "<|endoftext|>",
|
| 125 |
+
"padding_side": "left",
|
| 126 |
+
"sp_model_kwargs": {},
|
| 127 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 128 |
+
"unk_token": "<unk>",
|
| 129 |
+
"use_default_system_prompt": false
|
| 130 |
+
}
|