Personal repository for SoA Deep Learning building blocks (in PyTorch)
Project description
DeepTorchBlocks
https://github.com/StefanoGiacomelli/DeepTorchBlocks/tree/main/nn_modules
...a repository for SoA Neural Networks building blocks (written in pure Python & PyTorch)
Read the API Documentation
View Demo
·
Report Bug
·
Request Feature
Table of Contents
DeepTorchBlocks
This is a work-in-progress repository: please do not complain about code instability!
This project was born with the aim to collect and develop a general-purpose set of building blocks, for Neural Network architectures programming and researches structuring. For various reasons, one will be faced with the impossibility of directly exploiting pre-trained architectures and/or modules and will be forced to re-implement from scratch each layer (and or component) of the desired algorithm. To facilitate this step, DeepTorchBlocks gives us a hand with a careful selection (under continuous revisioning and updating) of state-of-the-art modules coming from CV, NLP and other reearch fields, inheriting all standard nn.Module
(PyTorch) features and methods.
You will not find any pre-trained NNs architecture here, only building (sub-)modules!
Built With
For end-users:
NumPy
& related dependecies (for math operations)PyTorch
& related dependecies (for modules inheritance)
For developers:
- torch-summary/torchinfo (for modules parameters report)
- torchview & related dependecies (for architectural monitoring)
pytest
& related dependecies (for modules testing)
...
Getting Started
This is an example of how you may set up your project locally. To get a local copy up and running follow these simple steps.
Cloning repository
- for Colab Notebooks
!git clone https://github.com/StefanoGiacomelli/DeepTorchBlocks.git %cd './DeepTorchBlocks/nn_modules'
call Class and/or Functions directly from related Python files.
Installation
-
Install the package
!pip install DeepTorchBlocks
this will also auto-install required dependecies
-
Install auxiliary packages (for developers only)
!pip install torchview from torchview import draw_graph !pip install torchinfo from torchinfo import summary
Usage
device = 'cuda' if torch.cuda.is_available() else 'cpu'
x = torch.rand([1, 3, 200, 200], device=device) # An example RGB tensor of a single batch, with 200x200 pixels
model = ConvBlock(in_channels = 3,
out_channels = 10,
kernel_size = 3,
stride = 2,
padding = 1,
activation = nn.ReLU(),
device=device)
model(x)
>>> torch.Tensor(1, 10, 100, 100)
For more examples, please refer to the Documentation
Roadmap
- Add Bi-dir ConvRNN
- Define Tests pipeline (shape, self.params correctness, forward etc.)
- Compile documentation (SPhinx & ReadTheDocs template w. LaTeX extensions)
- Metrics.py (classification) & Utils.py (dataset, pre-processing
- CI/CD .github-workflow: for each admin push: Test-pipeline -> Package compilation & pubblication -> Documentation update
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewFeature
) - Commit your Changes (
git commit -m 'Add some NewFeature'
) - Push to the Branch (
git push origin feature/NewFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Stefano Giacomelli - https://www.linkedin.com/in/stefano-giacomelli-811654135/ - stefano.giacomelli@graduate.univaq.it
Project Link: https://github.com/StefanoGiacomelli/DeepTorchBlocks
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for DeepTorchBlocks-0.0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7df026038704af9ed35bd32c1414473bd6a7fcca74351488821bf6576850e20 |
|
MD5 | 37d7bc5e91bb19970f0f8b2b4f33220e |
|
BLAKE2b-256 | 4a4036b92c05376371437cad90fbd1fd1c5d6a0c6a6011c391fa36df5c61e601 |