Image-to-Text
PEFT
Safetensors
medical-imaging
chest-xray
dermoscopy
vision-language
fairness
lora
mimic-cxr
padchest
ham10000
Instructions to use mbhosale/FairLLaVA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mbhosale/FairLLaVA with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Add MIMIC-CXR FairLLaVA checkpoint
Browse files- mimic-cxr/README.md +26 -0
- mimic-cxr/adapter_config.json +38 -0
- mimic-cxr/adapter_model.safetensors +3 -0
- mimic-cxr/config.json +44 -0
- mimic-cxr/mm_projector.bin +3 -0
- mimic-cxr/non_lora_trainables.bin +3 -0
- mimic-cxr/special_tokens_map.json +24 -0
- mimic-cxr/tokenizer.model +3 -0
- mimic-cxr/tokenizer_config.json +43 -0
mimic-cxr/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: peft
|
| 4 |
+
base_model: lmsys/vicuna-7b-v1.5
|
| 5 |
+
tags:
|
| 6 |
+
- medical-imaging
|
| 7 |
+
- chest-xray
|
| 8 |
+
- mimic-cxr
|
| 9 |
+
- fairness
|
| 10 |
+
- lora
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# FairLLaVA — MIMIC-CXR
|
| 14 |
+
|
| 15 |
+
Fairness-aware LoRA adapter on top of LLaVA-Rad (Vicuna-7B + BiomedCLIP-CXR-518)
|
| 16 |
+
for MIMIC-CXR chest-X-ray report generation. Trained with the FairLLaVA
|
| 17 |
+
mutual-information regularizer on patient demographics (age, sex, race).
|
| 18 |
+
|
| 19 |
+
## Files
|
| 20 |
+
- `adapter_model.safetensors`, `adapter_config.json`, `non_lora_trainables.bin` — LoRA weights
|
| 21 |
+
- `mm_projector.bin` — multimodal projector
|
| 22 |
+
- `tokenizer.model`, `tokenizer_config.json`, `special_tokens_map.json`, `config.json` — tokenizer / config
|
| 23 |
+
|
| 24 |
+
## Usage
|
| 25 |
+
See https://github.com/bhosalems/FairLLaVA → `inference.py`. Point `model_path` at
|
| 26 |
+
this directory and set `model_base="lmsys/vicuna-7b-v1.5"`.
|
mimic-cxr/adapter_config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "lmsys/vicuna-7b-v1.5",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layer_replication": null,
|
| 10 |
+
"layers_pattern": null,
|
| 11 |
+
"layers_to_transform": null,
|
| 12 |
+
"loftq_config": {},
|
| 13 |
+
"lora_alpha": 128,
|
| 14 |
+
"lora_dropout": 0.05,
|
| 15 |
+
"megatron_config": null,
|
| 16 |
+
"megatron_core": "megatron.core",
|
| 17 |
+
"modules_to_save": [
|
| 18 |
+
"club_modules.age",
|
| 19 |
+
"club_modules.race",
|
| 20 |
+
"club_modules.gender"
|
| 21 |
+
],
|
| 22 |
+
"peft_type": "LORA",
|
| 23 |
+
"r": 64,
|
| 24 |
+
"rank_pattern": {},
|
| 25 |
+
"revision": null,
|
| 26 |
+
"target_modules": [
|
| 27 |
+
"up_proj",
|
| 28 |
+
"q_proj",
|
| 29 |
+
"k_proj",
|
| 30 |
+
"v_proj",
|
| 31 |
+
"o_proj",
|
| 32 |
+
"down_proj",
|
| 33 |
+
"gate_proj"
|
| 34 |
+
],
|
| 35 |
+
"task_type": "CAUSAL_LM",
|
| 36 |
+
"use_dora": false,
|
| 37 |
+
"use_rslora": false
|
| 38 |
+
}
|
mimic-cxr/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c8985de1c3d5e0be1617698338207fb9128f4586475cc0b429f5d1f0a6c6342
|
| 3 |
+
size 319991916
|
mimic-cxr/config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "lmsys/vicuna-7b-v1.5",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"freeze_mm_mlp_adapter": false,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 4096,
|
| 13 |
+
"image_aspect_ratio": "square",
|
| 14 |
+
"image_grid_pinpoints": null,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 11008,
|
| 17 |
+
"max_position_embeddings": 4096,
|
| 18 |
+
"mm_hidden_size": 768,
|
| 19 |
+
"mm_projector_type": "mlp2x_gelu",
|
| 20 |
+
"mm_use_im_patch_token": false,
|
| 21 |
+
"mm_use_im_start_end": false,
|
| 22 |
+
"mm_vision_select_feature": "patch",
|
| 23 |
+
"mm_vision_select_layer": -2,
|
| 24 |
+
"mm_vision_tower": "biomedclip_cxr_518",
|
| 25 |
+
"mm_vision_tower_checkpoint": "/home/csgrad/mbhosale/phd/MrFair/LLaVA-Rad/llava-rad_hf/biomedclipcxr_518_checkpoint.pt",
|
| 26 |
+
"mm_vision_tower_config": "llava/model/multimodal_encoder/open_clip_encoder/model_configs/biomedclip_cxr_518.json",
|
| 27 |
+
"model_type": "llava",
|
| 28 |
+
"num_attention_heads": 32,
|
| 29 |
+
"num_hidden_layers": 32,
|
| 30 |
+
"num_key_value_heads": 32,
|
| 31 |
+
"output_hidden_states": true,
|
| 32 |
+
"pad_token_id": 0,
|
| 33 |
+
"pretraining_tp": 1,
|
| 34 |
+
"rms_norm_eps": 1e-05,
|
| 35 |
+
"rope_scaling": null,
|
| 36 |
+
"rope_theta": 10000.0,
|
| 37 |
+
"tie_word_embeddings": false,
|
| 38 |
+
"torch_dtype": "float16",
|
| 39 |
+
"transformers_version": "4.39.3",
|
| 40 |
+
"tune_mm_mlp_adapter": false,
|
| 41 |
+
"use_cache": false,
|
| 42 |
+
"use_mm_proj": true,
|
| 43 |
+
"vocab_size": 32000
|
| 44 |
+
}
|
mimic-cxr/mm_projector.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:edc0c9123bca4edabc7f64c51772464917ba934a73ad7199ed26f3ac288d1c86
|
| 3 |
+
size 302008633
|
mimic-cxr/non_lora_trainables.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afcc665b33a66ff25a10f091cb8c1de2edaa5ec4f2e2d60aef7e4cf826b39526
|
| 3 |
+
size 39864496
|
mimic-cxr/special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<unk>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
mimic-cxr/tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
mimic-cxr/tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": true,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"clean_up_tokenization_spaces": false,
|
| 33 |
+
"eos_token": "</s>",
|
| 34 |
+
"legacy": false,
|
| 35 |
+
"model_max_length": 2048,
|
| 36 |
+
"pad_token": "<unk>",
|
| 37 |
+
"padding_side": "right",
|
| 38 |
+
"sp_model_kwargs": {},
|
| 39 |
+
"spaces_between_special_tokens": false,
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|