Instructions to use BlueMen/Medrx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use BlueMen/Medrx with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "BlueMen/Medrx") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +17 -1
- adapter_config.json +44 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +1 -0
- tokenizer.json +3 -0
- tokenizer_config.json +127 -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
|
README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags: [medical, clinical, drug-recommendation, phi-4, lora, qlora]
|
| 5 |
+
base_model: unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit
|
| 6 |
---
|
| 7 |
+
# Phi-4-mini Drug & Treatment Recommendation LoRA Adapter v6.1
|
| 8 |
+
Fine-tuned for evidence-based drug and treatment recommendation.
|
| 9 |
+
Built on `unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit` using QLoRA (4-bit NF4).
|
| 10 |
+
| Parameter | Value |
|
| 11 |
+
|---|---|
|
| 12 |
+
| Base model | `unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit` |
|
| 13 |
+
| LoRA rank | 16 | LoRA alpha | 32 (α/r=2.0) |
|
| 14 |
+
| Max seq len | 1024 | LR | 0.0002 | Epochs | 3 |
|
| 15 |
+
| Training samples | 13041 | Eval samples | 687 |
|
| 16 |
+
| Final train loss | 0.2892 | Early stopped | True |
|
| 17 |
+
| Loss masking | Response-only (DataCollatorForCompletionOnlyLM) |
|
| 18 |
+
| Version | v6.1 | Date | 2026-06-30 |
|
| 19 |
+
**Clinical decision support only. Final decisions rest with the treating physician.**
|
adapter_config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Phi3ForCausalLM",
|
| 7 |
+
"parent_library": "transformers.models.phi3.modeling_phi3",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit",
|
| 11 |
+
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 16 |
+
"fan_in_fan_out": false,
|
| 17 |
+
"inference_mode": true,
|
| 18 |
+
"init_lora_weights": true,
|
| 19 |
+
"layer_replication": null,
|
| 20 |
+
"layers_pattern": null,
|
| 21 |
+
"layers_to_transform": null,
|
| 22 |
+
"loftq_config": {},
|
| 23 |
+
"lora_alpha": 32,
|
| 24 |
+
"lora_bias": false,
|
| 25 |
+
"lora_dropout": 0,
|
| 26 |
+
"lora_ga_config": null,
|
| 27 |
+
"megatron_config": null,
|
| 28 |
+
"megatron_core": "megatron.core",
|
| 29 |
+
"modules_to_save": null,
|
| 30 |
+
"peft_type": "LORA",
|
| 31 |
+
"peft_version": "0.19.1",
|
| 32 |
+
"qalora_group_size": 16,
|
| 33 |
+
"r": 16,
|
| 34 |
+
"rank_pattern": {},
|
| 35 |
+
"revision": null,
|
| 36 |
+
"target_modules": "(?:.*?(?:language|text).*?(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer).*?(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj))|(?:\\bmodel\\.layers\\.[\\d]{1,}\\.(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer)\\.(?:(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)))",
|
| 37 |
+
"target_parameters": null,
|
| 38 |
+
"task_type": "CAUSAL_LM",
|
| 39 |
+
"trainable_token_indices": null,
|
| 40 |
+
"use_bdlora": null,
|
| 41 |
+
"use_dora": false,
|
| 42 |
+
"use_qalora": false,
|
| 43 |
+
"use_rslora": false
|
| 44 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d6fc8ec810a344b5b625be55f3ca736944de0164071556026c4df6188cfe6ca
|
| 3 |
+
size 35668592
|
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 %}
|
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,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
}
|