Text Generation
Transformers
Safetensors
English
phi3
text-generation-inference
unsloth
conversational
custom_code
Instructions to use ESarp/Phi-4-Mini-AttackTree-DPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ESarp/Phi-4-Mini-AttackTree-DPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ESarp/Phi-4-Mini-AttackTree-DPO", trust_remote_code=True) 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("ESarp/Phi-4-Mini-AttackTree-DPO", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("ESarp/Phi-4-Mini-AttackTree-DPO", trust_remote_code=True, 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 ESarp/Phi-4-Mini-AttackTree-DPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ESarp/Phi-4-Mini-AttackTree-DPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ESarp/Phi-4-Mini-AttackTree-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ESarp/Phi-4-Mini-AttackTree-DPO
- SGLang
How to use ESarp/Phi-4-Mini-AttackTree-DPO 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 "ESarp/Phi-4-Mini-AttackTree-DPO" \ --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": "ESarp/Phi-4-Mini-AttackTree-DPO", "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 "ESarp/Phi-4-Mini-AttackTree-DPO" \ --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": "ESarp/Phi-4-Mini-AttackTree-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use ESarp/Phi-4-Mini-AttackTree-DPO with Docker Model Runner:
docker model run hf.co/ESarp/Phi-4-Mini-AttackTree-DPO
(Trained with Unsloth)
Browse files- .gitattributes +1 -0
- chat_template.jinja +1 -0
- config.json +148 -0
- generation_config.json +10 -0
- tokenizer.json +3 -0
- tokenizer_config.json +128 -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
|
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|>' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"torch_dtype": "bfloat16",
|
| 14 |
+
"embd_pdrop": 0.0,
|
| 15 |
+
"eos_token_id": 200020,
|
| 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_name": "unsloth/Phi-4-mini-instruct-bnb-4bit",
|
| 26 |
+
"model_type": "phi3",
|
| 27 |
+
"num_attention_heads": 24,
|
| 28 |
+
"num_hidden_layers": 32,
|
| 29 |
+
"num_key_value_heads": 8,
|
| 30 |
+
"original_max_position_embeddings": 4096,
|
| 31 |
+
"pad_token_id": 200029,
|
| 32 |
+
"partial_rotary_factor": 0.75,
|
| 33 |
+
"resid_pdrop": 0.0,
|
| 34 |
+
"rms_norm_eps": 1e-05,
|
| 35 |
+
"rope_parameters": {
|
| 36 |
+
"long_factor": [
|
| 37 |
+
1,
|
| 38 |
+
1.118320672,
|
| 39 |
+
1.250641126,
|
| 40 |
+
1.398617824,
|
| 41 |
+
1.564103225,
|
| 42 |
+
1.74916897,
|
| 43 |
+
1.956131817,
|
| 44 |
+
2.187582649,
|
| 45 |
+
2.446418898,
|
| 46 |
+
2.735880826,
|
| 47 |
+
3.059592084,
|
| 48 |
+
3.421605075,
|
| 49 |
+
3.826451687,
|
| 50 |
+
4.279200023,
|
| 51 |
+
4.785517845,
|
| 52 |
+
5.351743533,
|
| 53 |
+
5.984965424,
|
| 54 |
+
6.693110555,
|
| 55 |
+
7.485043894,
|
| 56 |
+
8.370679318,
|
| 57 |
+
9.36110372,
|
| 58 |
+
10.4687158,
|
| 59 |
+
11.70738129,
|
| 60 |
+
13.09260651,
|
| 61 |
+
14.64173252,
|
| 62 |
+
16.37415215,
|
| 63 |
+
18.31155283,
|
| 64 |
+
20.47818807,
|
| 65 |
+
22.90118105,
|
| 66 |
+
25.61086418,
|
| 67 |
+
28.64115884,
|
| 68 |
+
32.03,
|
| 69 |
+
32.1,
|
| 70 |
+
32.13,
|
| 71 |
+
32.23,
|
| 72 |
+
32.6,
|
| 73 |
+
32.61,
|
| 74 |
+
32.64,
|
| 75 |
+
32.66,
|
| 76 |
+
32.7,
|
| 77 |
+
32.71,
|
| 78 |
+
32.93,
|
| 79 |
+
32.97,
|
| 80 |
+
33.28,
|
| 81 |
+
33.49,
|
| 82 |
+
33.5,
|
| 83 |
+
44.16,
|
| 84 |
+
47.77
|
| 85 |
+
],
|
| 86 |
+
"original_max_position_embeddings": 4096,
|
| 87 |
+
"partial_rotary_factor": 0.75,
|
| 88 |
+
"rope_theta": 10000.0,
|
| 89 |
+
"rope_type": "longrope",
|
| 90 |
+
"short_factor": [
|
| 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 |
+
1.0
|
| 139 |
+
],
|
| 140 |
+
"type": "longrope"
|
| 141 |
+
},
|
| 142 |
+
"sliding_window": 262144,
|
| 143 |
+
"tie_word_embeddings": true,
|
| 144 |
+
"unsloth_fixed": true,
|
| 145 |
+
"unsloth_version": "2026.8.18",
|
| 146 |
+
"use_cache": true,
|
| 147 |
+
"vocab_size": 200064
|
| 148 |
+
}
|
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 |
+
],
|
| 7 |
+
"max_length": 131072,
|
| 8 |
+
"pad_token_id": 200029,
|
| 9 |
+
"transformers_version": "5.5.0"
|
| 10 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f03ea2905c4756993ab91ac167a2e667123703fc9cc238576d667ea4efce0a3a
|
| 3 |
+
size 15524853
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|end|>",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"model_max_length": 131072,
|
| 9 |
+
"pad_token": "<|PAD▁TOKEN|>",
|
| 10 |
+
"padding_side": "left",
|
| 11 |
+
"tokenizer_class": "TokenizersBackend",
|
| 12 |
+
"unk_token": "�",
|
| 13 |
+
"added_tokens_decoder": {
|
| 14 |
+
"3251": {
|
| 15 |
+
"content": "�",
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"lstrip": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"199999": {
|
| 23 |
+
"content": "<|endoftext|>",
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"special": true
|
| 29 |
+
},
|
| 30 |
+
"200018": {
|
| 31 |
+
"content": "<|endofprompt|>",
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"lstrip": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"normalized": false,
|
| 36 |
+
"special": true
|
| 37 |
+
},
|
| 38 |
+
"200019": {
|
| 39 |
+
"content": "<|assistant|>",
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"lstrip": false,
|
| 42 |
+
"rstrip": true,
|
| 43 |
+
"normalized": false,
|
| 44 |
+
"special": true
|
| 45 |
+
},
|
| 46 |
+
"200020": {
|
| 47 |
+
"content": "<|end|>",
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"lstrip": false,
|
| 50 |
+
"rstrip": true,
|
| 51 |
+
"normalized": false,
|
| 52 |
+
"special": true
|
| 53 |
+
},
|
| 54 |
+
"200021": {
|
| 55 |
+
"content": "<|user|>",
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"lstrip": false,
|
| 58 |
+
"rstrip": true,
|
| 59 |
+
"normalized": false,
|
| 60 |
+
"special": true
|
| 61 |
+
},
|
| 62 |
+
"200022": {
|
| 63 |
+
"content": "<|system|>",
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"lstrip": false,
|
| 66 |
+
"rstrip": true,
|
| 67 |
+
"normalized": false,
|
| 68 |
+
"special": true
|
| 69 |
+
},
|
| 70 |
+
"200023": {
|
| 71 |
+
"content": "<|tool|>",
|
| 72 |
+
"single_word": false,
|
| 73 |
+
"lstrip": false,
|
| 74 |
+
"rstrip": true,
|
| 75 |
+
"normalized": false,
|
| 76 |
+
"special": false
|
| 77 |
+
},
|
| 78 |
+
"200024": {
|
| 79 |
+
"content": "<|/tool|>",
|
| 80 |
+
"single_word": false,
|
| 81 |
+
"lstrip": false,
|
| 82 |
+
"rstrip": true,
|
| 83 |
+
"normalized": false,
|
| 84 |
+
"special": false
|
| 85 |
+
},
|
| 86 |
+
"200025": {
|
| 87 |
+
"content": "<|tool_call|>",
|
| 88 |
+
"single_word": false,
|
| 89 |
+
"lstrip": false,
|
| 90 |
+
"rstrip": true,
|
| 91 |
+
"normalized": false,
|
| 92 |
+
"special": false
|
| 93 |
+
},
|
| 94 |
+
"200026": {
|
| 95 |
+
"content": "<|/tool_call|>",
|
| 96 |
+
"single_word": false,
|
| 97 |
+
"lstrip": false,
|
| 98 |
+
"rstrip": true,
|
| 99 |
+
"normalized": false,
|
| 100 |
+
"special": false
|
| 101 |
+
},
|
| 102 |
+
"200027": {
|
| 103 |
+
"content": "<|tool_response|>",
|
| 104 |
+
"single_word": false,
|
| 105 |
+
"lstrip": false,
|
| 106 |
+
"rstrip": true,
|
| 107 |
+
"normalized": false,
|
| 108 |
+
"special": false
|
| 109 |
+
},
|
| 110 |
+
"200028": {
|
| 111 |
+
"content": "<|tag|>",
|
| 112 |
+
"single_word": false,
|
| 113 |
+
"lstrip": false,
|
| 114 |
+
"rstrip": true,
|
| 115 |
+
"normalized": false,
|
| 116 |
+
"special": true
|
| 117 |
+
},
|
| 118 |
+
"200029": {
|
| 119 |
+
"content": "<|PAD▁TOKEN|>",
|
| 120 |
+
"single_word": false,
|
| 121 |
+
"lstrip": false,
|
| 122 |
+
"rstrip": false,
|
| 123 |
+
"normalized": false,
|
| 124 |
+
"special": true
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"chat_template": "{% 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|>' }}{% endif %}"
|
| 128 |
+
}
|