CoolFace
Modelpublic

filipelopesmedbr/icd11-llm-ministral-8b

sourceHugging Faceotherupdated 1y agoView on Hugging Face
0likes26downloads
Model Card

<!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. -->

<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/> <details><summary>See axolotl config</summary>

axolotl version: 0.8.0.dev0

yaml
# ============================================================
# Configuração Axolotl para finetuning do modelo Mistral 8B
# (arquivo: axolotl_2_a40_runpod_config.yaml)
# ============================================================

# ============================================================
# 1. Modelo Base e Configurações Gerais
# ------------------------------------------------------------
base_model: mistralai/Ministral-8B-Instruct-2410

# ------------------------------------------------------------
# 2. Quantização / dtype
#   - load_in_4bit: false (vamos usar LoRA puro)
#   - load_in_8bit: false
#   - bf16: true    (carregar em bfloat16 para A40)
#   - fp16: false
# ------------------------------------------------------------
load_in_8bit: false
load_in_4bit: false         
bf16: true
fp16: false

# ------------------------------------------------------------
# 3. Chat template e tokens especiais
# ------------------------------------------------------------
chat_template: mistral_v2v3
special_tokens:
  bos_token: "<s>"
  eos_token: "</s>"

# ============================================================
# 4. Paths dos Datasets (cada split numa linha separada)
#  
# Atenção: cada bloco dentro de `datasets:` deve ter um "path: <string>"
# e um "split: train" ou "split: validation".  
# ============================================================
datasets:
  - path: dataset
    split: train
    type: alpaca
    field_instruction: instruction
    field_input: input
    field_output: output
    field_weight: weight

validation_datasets:
  - path: dataset
    split: validation
    type: alpaca
    field_instruction: instruction
    field_input: input
    field_output: output

# (Opcional) Se quiser um split separado de test para avaliação final,
# basta descomentar este bloco e criar “datasets/test.jsonl”.
test_datasets:
  - path: dataset
    split: test
    type: alpaca
    field_instruction: instruction
    field_input: input
    field_output: output

# ============================================================
# 5. Configuração de Treino LoRA
# ------------------------------------------------------------
adapter: lora
lora_r: 8
lora_alpha: 16
lora_dropout: 0.05
lora_target_modules:
  - gate_proj
  - down_proj
  - up_proj
  - q_proj
  - v_proj
  - k_proj
  - o_proj

# Módulos LoRA a salvar para inferência leve
lora_modules_to_save:
  - embed_tokens
  - lm_head

# ============================================================
# 6. Batch / Gradiente / Checkpointing
# ------------------------------------------------------------
micro_batch_size: 20
gradient_accumulation_steps: 4
gradient_checkpointing: true

# ============================================================
# 7. Otimizador / Scheduler
# ------------------------------------------------------------
learning_rate: 0.0001
optimizer: adamw_bnb_8bit
lr_scheduler: cosine

# ============================================================
# 8. Épocas / Sequence Len / Packing
# ------------------------------------------------------------
num_epochs: 3
sequence_len: 1536
pad_to_sequence_len: false
sample_packing: true

# ============================================================
# 9. Log / Checkpoints / Avaliações
# ------------------------------------------------------------
logging_steps: 40
evals_per_epoch: 4
save_per_epoch: 4

# ============================================================
# 10. Diretórios de Saída
# ------------------------------------------------------------
output_dir: ./outputs/cid11-agent-mistral-8b
save_safetensors: true

# ============================================================
# 11. Atenção / Configurações Adicionais
# ------------------------------------------------------------
device_map: auto
attn_implementation: flash_attention_2
flash_attention: false

resume_from_checkpoint: null
save_total_limit: 3

# ============================================================
# 12. Métricas de Avaliação Personalizadas
# ------------------------------------------------------------
# O Axolotl monitora internamente “eval_loss”.  
# Se quiser acrescentar “eval_accuracy” (por ex., comparar
# o conteúdo dentro de <code>…</code>), tem que fazer por fora.
#
# Basta manter estas duas linhas (não removê-las), mesmo que
# você tenha retirado o bloco callbacks. Depois, rodar um script
# externo que leia o arquivo “outputs/predictions.jsonl” e 
# compare com “datasets/validation.jsonl” para obter a acurácia.
monitor: eval_loss

# — Forçar o Axolotl a gerar predições em cada validação ——
predict_with_generate: true

# — Se quiser salvar essas predições no disco, deixe true ——
save_preds: true

# ============================================================
# 13. (Não há mais callback_modules nem callbacks aqui)
# ============================================================

# ============================================================
# 14. Estrutura esperada de pastas no repositório:
#
# CIEL-Clinical-Concepts-to-ICD-11/
# ├── axolotl_2_a40_runpod_config.yaml   ← este arquivo
# ├── datasets/
# │   ├── train.jsonl
# │   ├── validation.jsonl
# │   └── test.jsonl   (opcional se você quisesse finetune+teste juntos)
# ├── scripts/
# │   └── custom_metrics_callback.py     (se for usar callback externamente)
# ├── outputs/                           (aqui ficarão checkpoints e predictions.jsonl)
# └── train.py  (opcional, não é mandatório para Axolotl CLI)
# ============================================================

</details><br>

outputs/cid11-agent-mistral-8b

This model is a fine-tuned version of mistralai/Ministral-8B-Instruct-2410 on the None dataset. It achieves the following results on the evaluation set:

  • —Loss: 0.0164

Model description

More information needed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • —learning_rate: 0.0001
  • —trainbatchsize: 20
  • —evalbatchsize: 20
  • —seed: 42
  • —gradientaccumulationsteps: 4
  • —totaltrainbatch_size: 80
  • —optimizer: Use OptimizerNames.ADAMWBNB with betas=(0.9,0.999) and epsilon=1e-08 and optimizerargs=No additional optimizer arguments
  • —lrschedulertype: cosine
  • —lrschedulerwarmup_steps: 36
  • —num_epochs: 3.0

Training results

Training LossEpochStepValidation Loss
No log0.002512.1747
0.07360.25161010.0500
0.03790.50312020.0351
0.03080.75473030.0292
0.02551.00504040.0251
0.02011.25655050.0220
0.01831.50816060.0201
0.01721.75977070.0185
0.01572.01008080.0174
0.01222.26159090.0170
0.01192.513110100.0166
0.01182.764611110.0164

Framework versions

  • —PEFT 0.14.0
  • —Transformers 4.49.0
  • —Pytorch 2.5.1+cu124
  • —Datasets 3.2.0
  • —Tokenizers 0.21.0