Text Generation
Transformers
Safetensors
English
phi3
text-generation-inference
unsloth
mergekit
danbooru
image-captioning
tagging
phi-4
finetune
anime
conversational
custom_code
Instructions to use USS-Inferprise/Phi4-Mini-Prose2Tags-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use USS-Inferprise/Phi4-Mini-Prose2Tags-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="USS-Inferprise/Phi4-Mini-Prose2Tags-4B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("USS-Inferprise/Phi4-Mini-Prose2Tags-4B", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("USS-Inferprise/Phi4-Mini-Prose2Tags-4B", 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 USS-Inferprise/Phi4-Mini-Prose2Tags-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "USS-Inferprise/Phi4-Mini-Prose2Tags-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "USS-Inferprise/Phi4-Mini-Prose2Tags-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/USS-Inferprise/Phi4-Mini-Prose2Tags-4B
- SGLang
How to use USS-Inferprise/Phi4-Mini-Prose2Tags-4B 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 "USS-Inferprise/Phi4-Mini-Prose2Tags-4B" \ --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": "USS-Inferprise/Phi4-Mini-Prose2Tags-4B", "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 "USS-Inferprise/Phi4-Mini-Prose2Tags-4B" \ --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": "USS-Inferprise/Phi4-Mini-Prose2Tags-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use USS-Inferprise/Phi4-Mini-Prose2Tags-4B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for USS-Inferprise/Phi4-Mini-Prose2Tags-4B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for USS-Inferprise/Phi4-Mini-Prose2Tags-4B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for USS-Inferprise/Phi4-Mini-Prose2Tags-4B to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="USS-Inferprise/Phi4-Mini-Prose2Tags-4B", max_seq_length=2048, ) - Docker Model Runner
How to use USS-Inferprise/Phi4-Mini-Prose2Tags-4B with Docker Model Runner:
docker model run hf.co/USS-Inferprise/Phi4-Mini-Prose2Tags-4B
Upload 7 files
Browse files- .gitattributes +1 -0
- Prose2Text-Template.txt +1 -0
- chat_template.jinja +1 -0
- config.json +146 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +12 -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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
Prose2Text-Template.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
prompt = f"<|user|>\nYou are a Danbooru tag translator.\n{prose_input}<|end|>\n<|assistant|>\n"
|
chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if message['role'] == 'system' and 'tools' in message and message['tools'] is not none %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|tool|>' + message['tools'] + '<|/tool|>' + '<|end|>' }}{% else %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|end|>' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>' }}{% else %}{{ eos_token }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Phi3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_phi3.Phi3Config",
|
| 9 |
+
"AutoModelForCausalLM": "modeling_phi3.Phi3ForCausalLM",
|
| 10 |
+
"AutoTokenizer": "Xenova/gpt-4o"
|
| 11 |
+
},
|
| 12 |
+
"bos_token_id": 199999,
|
| 13 |
+
"dtype": "bfloat16",
|
| 14 |
+
"embd_pdrop": 0.0,
|
| 15 |
+
"eos_token_id": 199999,
|
| 16 |
+
"full_attn_mod": 1,
|
| 17 |
+
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 3072,
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"intermediate_size": 8192,
|
| 21 |
+
"interpolate_factor": 1,
|
| 22 |
+
"lm_head_bias": false,
|
| 23 |
+
"max_position_embeddings": 131072,
|
| 24 |
+
"mlp_bias": false,
|
| 25 |
+
"model_type": "phi3",
|
| 26 |
+
"num_attention_heads": 24,
|
| 27 |
+
"num_hidden_layers": 32,
|
| 28 |
+
"num_key_value_heads": 8,
|
| 29 |
+
"original_max_position_embeddings": 4096,
|
| 30 |
+
"pad_token_id": 199999,
|
| 31 |
+
"partial_rotary_factor": 0.75,
|
| 32 |
+
"resid_pdrop": 0.0,
|
| 33 |
+
"rms_norm_eps": 1e-05,
|
| 34 |
+
"rope_parameters": {
|
| 35 |
+
"long_factor": [
|
| 36 |
+
1,
|
| 37 |
+
1.118320672,
|
| 38 |
+
1.250641126,
|
| 39 |
+
1.398617824,
|
| 40 |
+
1.564103225,
|
| 41 |
+
1.74916897,
|
| 42 |
+
1.956131817,
|
| 43 |
+
2.187582649,
|
| 44 |
+
2.446418898,
|
| 45 |
+
2.735880826,
|
| 46 |
+
3.059592084,
|
| 47 |
+
3.421605075,
|
| 48 |
+
3.826451687,
|
| 49 |
+
4.279200023,
|
| 50 |
+
4.785517845,
|
| 51 |
+
5.351743533,
|
| 52 |
+
5.984965424,
|
| 53 |
+
6.693110555,
|
| 54 |
+
7.485043894,
|
| 55 |
+
8.370679318,
|
| 56 |
+
9.36110372,
|
| 57 |
+
10.4687158,
|
| 58 |
+
11.70738129,
|
| 59 |
+
13.09260651,
|
| 60 |
+
14.64173252,
|
| 61 |
+
16.37415215,
|
| 62 |
+
18.31155283,
|
| 63 |
+
20.47818807,
|
| 64 |
+
22.90118105,
|
| 65 |
+
25.61086418,
|
| 66 |
+
28.64115884,
|
| 67 |
+
32.03,
|
| 68 |
+
32.1,
|
| 69 |
+
32.13,
|
| 70 |
+
32.23,
|
| 71 |
+
32.6,
|
| 72 |
+
32.61,
|
| 73 |
+
32.64,
|
| 74 |
+
32.66,
|
| 75 |
+
32.7,
|
| 76 |
+
32.71,
|
| 77 |
+
32.93,
|
| 78 |
+
32.97,
|
| 79 |
+
33.28,
|
| 80 |
+
33.49,
|
| 81 |
+
33.5,
|
| 82 |
+
44.16,
|
| 83 |
+
47.77
|
| 84 |
+
],
|
| 85 |
+
"original_max_position_embeddings": 4096,
|
| 86 |
+
"partial_rotary_factor": 0.75,
|
| 87 |
+
"rope_theta": 10000.0,
|
| 88 |
+
"rope_type": "longrope",
|
| 89 |
+
"short_factor": [
|
| 90 |
+
1.0,
|
| 91 |
+
1.0,
|
| 92 |
+
1.0,
|
| 93 |
+
1.0,
|
| 94 |
+
1.0,
|
| 95 |
+
1.0,
|
| 96 |
+
1.0,
|
| 97 |
+
1.0,
|
| 98 |
+
1.0,
|
| 99 |
+
1.0,
|
| 100 |
+
1.0,
|
| 101 |
+
1.0,
|
| 102 |
+
1.0,
|
| 103 |
+
1.0,
|
| 104 |
+
1.0,
|
| 105 |
+
1.0,
|
| 106 |
+
1.0,
|
| 107 |
+
1.0,
|
| 108 |
+
1.0,
|
| 109 |
+
1.0,
|
| 110 |
+
1.0,
|
| 111 |
+
1.0,
|
| 112 |
+
1.0,
|
| 113 |
+
1.0,
|
| 114 |
+
1.0,
|
| 115 |
+
1.0,
|
| 116 |
+
1.0,
|
| 117 |
+
1.0,
|
| 118 |
+
1.0,
|
| 119 |
+
1.0,
|
| 120 |
+
1.0,
|
| 121 |
+
1.0,
|
| 122 |
+
1.0,
|
| 123 |
+
1.0,
|
| 124 |
+
1.0,
|
| 125 |
+
1.0,
|
| 126 |
+
1.0,
|
| 127 |
+
1.0,
|
| 128 |
+
1.0,
|
| 129 |
+
1.0,
|
| 130 |
+
1.0,
|
| 131 |
+
1.0,
|
| 132 |
+
1.0,
|
| 133 |
+
1.0,
|
| 134 |
+
1.0,
|
| 135 |
+
1.0,
|
| 136 |
+
1.0,
|
| 137 |
+
1.0
|
| 138 |
+
],
|
| 139 |
+
"type": "longrope"
|
| 140 |
+
},
|
| 141 |
+
"sliding_window": 262144,
|
| 142 |
+
"tie_word_embeddings": true,
|
| 143 |
+
"transformers_version": "5.5.0",
|
| 144 |
+
"use_cache": true,
|
| 145 |
+
"vocab_size": 200064
|
| 146 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 199999,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
200020,
|
| 6 |
+
199999
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 199999,
|
| 9 |
+
"transformers_version": "5.5.0"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04319702369987c97ae259274f4d0506ebb187d9a77ac37559838b54bfa6c431
|
| 3 |
+
size 7672066248
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ea8bdf68c3e7549a3fb4342523288ce628f6ab56a618f9a4dfb234a0b4d46a8
|
| 3 |
+
size 15524476
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"is_local": true,
|
| 8 |
+
"model_max_length": 131072,
|
| 9 |
+
"pad_token": "<|endoftext|>",
|
| 10 |
+
"tokenizer_class": "TokenizersBackend",
|
| 11 |
+
"unk_token": "<|endoftext|>"
|
| 12 |
+
}
|