Skip to content

Training Sequence

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Training execution sequence

The full fine-tuning path is implemented before the frozen-backbone comparison.

sequenceDiagram
    autonumber
    participant User as Python/Jupyter
    participant Hub as Hugging Face Hub
    participant DS as Dataset + Collator
    participant Model as DistilBERT Classifier
    participant Trainer as Trainer
    participant Disk as Local Files
    User->>DS: Build 30 records and stratified split
    User->>Hub: Load tokenizer and pretrained weights
    Hub-->>User: Tokenizer and weights
    User->>DS: Tokenize and configure dynamic padding
    User->>Model: Initialize four-label classifier
    User->>Trainer: TrainingArguments + datasets + model
    loop For 4 epochs
      Trainer->>DS: Read padded batches
      DS-->>Trainer: input_ids, attention_mask, labels
      Trainer->>Model: Forward / loss / backward / optimizer step
      Trainer->>Model: Evaluate on 6 validation samples
      Model-->>Trainer: logits / metrics
      Trainer->>Disk: Save eligible epoch checkpoint
    end
    Trainer->>Disk: Save best_model and tokenizer
    User->>Trainer: predict(validation), evaluate()
    Trainer-->>User: accuracy, weighted F1, report and matrix
Loading

The Trainer calculates training loss and optimization updates. Evaluation runs each epoch; saving is also configured per epoch for the full fine-tune. The best model is selected by eval_f1_weighted. The code separately writes the selected model and tokenizer under support_classifier/best_model.

The diagram is an architectural sequence, not a trace from an executed GPU run.

Clone this wiki locally