Skip to content

mincasurong/pytorch_lightning_basic_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTorch Lightning Basic Library

This repository provides a basic framework for deep learning tasks using PyTorch Lightning. It includes essential modules for data preparation, model definition, training, and evaluation.

Project structures

pytorch_lightning_basic_lib/
├── pytorch_lightning_basic_lib/
│   ├── __init__.py
│   ├── data_module.py
│   ├── model.py
│   ├── train.py
│   └── evaluate.py
├── setup.py
├── README.md
└── requirements.txt

Modules

Data Module

  • TabularDataModule
    • setup(): Handling tabular data. Scale and split dataset for train, val, and test.
    • feature_selection(): Select features by analyzing correlation between inputs and output, and colinearity between each input.

Model

  • RegressionModel: A simple regression model defined using PyTorch.

Training

  • train_model: Function to train the regression model using PyTorch Lightning's Trainer.

Evaluation

  • evaluate_model: Function to evaluate the trained model's performance.

Getting Started

Prerequisites

  • Python 3.x
  • PyTorch
  • PyTorch Lightning

Installation

  1. Clone the repository:
    git clone https://github.com/mincasurong/pytorch_lightning_basic_lib.git
    cd pytorch_lightning_basic_lib
    pip install -r requirements.txt

Usage

  1. Prepare your data using TabularDataModule.
  2. Define and train your model using RegressionModel and train_model.
  3. Evaluate your trained model using evaluate_model.

Example

Here's a basic example to get you started:

from my_deep_learning_lib.data_module import TabularDataModule
from my_deep_learning_lib.model import RegressionModel
from my_deep_learning_lib.train import train_model
from my_deep_learning_lib.evaluate import evaluate_model
import pandas as pd

# Load your dataset
df = pd.read_csv('your_dataset.csv')
data_module = TabularDataModule(df, target_column='your_target_column', drop_columns=['drop_column1', 'drop_column2'])
data_module.prepare_data()
data_module.setup()

# Define and train the model
model = RegressionModel(input_dim=len(data_module.selected_features))
trained_model = train_model(data_module, model)

# Evaluate the model
evaluate_model(trained_model, data_module)

Reference

For more details on the implementation, please refer to the PyTorch Lightning documentation: PyTorch Lightning Docs.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any improvements or additions.

Acknowledgements

Special thanks to the PyTorch and PyTorch Lightning communities for their continuous support and resources.

License

This project is licensed under the MIT License

Contact

If you have any questions, search on google → mincasurong

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages