Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions torchTextClassifiers/torchTextClassifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ def train(
- Model training with early stopping
- Best model loading after training

Note on Checkpoints:
After training, the best model checkpoint is automatically loaded.
This checkpoint contains the full training state (model weights,
optimizer, and scheduler state). Loading uses weights_only=False
as the checkpoint is self-generated and trusted.

Args:
X_train: Training input data
y_train: Training labels
Expand Down Expand Up @@ -361,6 +367,7 @@ def train(
best_model_path,
model=self.pytorch_model,
loss=training_config.loss,
weights_only=False, # Required: checkpoint contains optimizer/scheduler state
)

self.pytorch_model = self.lightning_module.model.to(self.device)
Expand Down
Loading