शुरू करेंमुफ़्त में शुरू करें

Training and evaluating

In this exercise, we'll bring together al that we've practiced so far, by training and evaluating a neural network on the real-world dataset of handwritten Ethiopian MNIST characters.

ImageClassifier is a predefined neural network model implemented using PyTorch Lightning. It consists of convolutional layers for feature extraction, activation functions for introducing non-linearity, and fully connected layers for classification.

The Ethiopic MNIST dataset was pre-imported for you.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Scalable AI Models with PyTorch Lightning

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Import the Trainer.
  • Define ImageClassifier model and trainer.
  • Train the model.
  • Evaluate the model on the validation set.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Import the Trainer
from lightning.pytorch import ____

# Define ImageClassifier model & trainer and set epoch parameter
model = ____()
trainer = ____(max_epochs=5)

# Train the model
trainer.fit(____, train_loader, val_loader)

# Evaluate the model
val_results = trainer.____(____, val_loader)
print("Validation Accuracy:", val_results[0]["val_acc"])
कोड संपादित करें और चलाएँ