Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoutsikakis committed Aug 11, 2019
0 parents commit ff95fb1
Show file tree
Hide file tree
Showing 75 changed files with 8,880 additions and 0 deletions.
117 changes: 117 additions & 0 deletions .gitignore
@@ -0,0 +1,117 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

#editors
.idea

#mac
.DS_STORE
19 changes: 19 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,19 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.6
install:
- requirements: docs/requirements.txt
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 John Koutsikakis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
34 changes: 34 additions & 0 deletions README.md
@@ -0,0 +1,34 @@
# PyTorchWrapper

PyTorchWrapper is a library that provides a systematic and extensible way to build, train, evaluate, and tune deep learning models
using PyTorch. It also provides several ready to use modules and functions for fast model development.

## Installation

### From PyPI
```bash
pip install pytorch-wrapper
```

### From Source

```bash
git clone https://github.com/jkoutsikakis/pytorch-wrapper.git
cd pytorch-wrapper
pip install .
```

## Docs & Examples

The docs can be found [here](https://pytorch-wrapper.readthedocs.io/en/latest/).

There are also the following examples in notebook format:

1. [Two Spiral Task](examples/1_two_spiral_task.ipynb)
2. [Image Classification Task](examples/2_image_classification_task.ipynb)
3. [Tuning Image Classifier](examples/3_tuning_image_classifier.ipynb)
4. [Text Classification Task](examples/4_text_classification_task.ipynb)
5. [Sequence Classification Task](examples/5_sequence_classification_task.ipynb)
6. [Custom Callback](examples/6_custom_callback.ipynb)
7. [Custom Loss Wrapper](examples/7_custom_loss_wrapper.ipynb)
8. [Custom Evaluator](examples/8_custom_evaluator.ipynb)
20 changes: 20 additions & 0 deletions docs/Makefile
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
7 changes: 7 additions & 0 deletions docs/_rst/evaluators.rst
@@ -0,0 +1,7 @@
Evaluators
----------

.. automodule:: pytorch_wrapper.evaluators
:members:
:undoc-members:
:show-inheritance:
12 changes: 12 additions & 0 deletions docs/_rst/examples.rst
@@ -0,0 +1,12 @@
************
Examples
************

1. `Two Spiral Task <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/1_two_spiral_task.ipynb>`_
2. `Image Classification Task <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/2_image_classification_task.ipynb>`_
3. `Tuning Image Classifier <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/3_tuning_image_classifier.ipynb>`_
4. `Text Classification Task <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/4_text_classification_task.ipynb>`_
5. `Sequence Classification Task <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/5_sequence_classification_task.ipynb>`_
6. `Custom Callback <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/6_custom_callback.ipynb>`_
7. `Custom Loss Wrapper <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/7_custom_loss_wrapper.ipynb>`_
8. `Custom Evaluator <https://github.com/jkoutsikakis/pytorch-wrapper/tree/develop/examples/8_custom_evaluator.ipynb>`_
7 changes: 7 additions & 0 deletions docs/_rst/functional.rst
@@ -0,0 +1,7 @@
Functional
----------

.. automodule:: pytorch_wrapper.functional
:members:
:undoc-members:
:show-inheritance:
19 changes: 19 additions & 0 deletions docs/_rst/installation.rst
@@ -0,0 +1,19 @@
************
Installation
************

Via PyPI
===================

.. code:: console
pip install pytorch-wrapper
Via Git
===================

.. code:: console
git clone https://github.com/jkoutsikakis/pytorch-wrapper.git
cd pytorch-wrapper
pip install .
10 changes: 10 additions & 0 deletions docs/_rst/introduction.rst
@@ -0,0 +1,10 @@
************
Introduction
************

PyTorchWrapper is a library that provides a systematic and extensible way to build, train, evaluate, and tune deep
learning models using PyTorch.

It also provides several ready to use modules and functions for fast model development.

`GitHub Link <https://github.com/jkoutsikakis/pytorch-wrapper>`_
7 changes: 7 additions & 0 deletions docs/_rst/loss_wrappers.rst
@@ -0,0 +1,7 @@
Loss Wrappers
-------------

.. automodule:: pytorch_wrapper.loss_wrappers
:members:
:undoc-members:
:show-inheritance:
114 changes: 114 additions & 0 deletions docs/_rst/modules.rst
@@ -0,0 +1,114 @@
Modules
=======

Dynamic Self Attention Encoder
------------------------------

.. automodule:: pytorch_wrapper.modules.dynamic_self_attention_encoder
:members:
:undoc-members:
:show-inheritance:

Embedding Layer
---------------

.. automodule:: pytorch_wrapper.modules.embedding_layer
:members:
:undoc-members:
:show-inheritance:

Layer Norm
----------

.. automodule:: pytorch_wrapper.modules.layer_norm
:members:
:undoc-members:
:show-inheritance:

MLP
---

.. automodule:: pytorch_wrapper.modules.mlp
:members:
:undoc-members:
:show-inheritance:

Multi-Head Attention
--------------------

.. automodule:: pytorch_wrapper.modules.multi_head_attention
:members:
:undoc-members:
:show-inheritance:

Residual
--------

.. automodule:: pytorch_wrapper.modules.residual
:members:
:undoc-members:
:show-inheritance:

Sequence Basic CNN Block
------------------------

.. automodule:: pytorch_wrapper.modules.sequence_basic_cnn_block
:members:
:undoc-members:
:show-inheritance:

Sequence Basic CNN Encoder
--------------------------

.. automodule:: pytorch_wrapper.modules.sequence_basic_cnn_encoder
:members:
:undoc-members:
:show-inheritance:

Sequence Dense CNN
------------------

.. automodule:: pytorch_wrapper.modules.sequence_dense_cnn
:members:
:undoc-members:
:show-inheritance:

Sinusoidal Positional Embedding Layer
-------------------------------------

.. automodule:: pytorch_wrapper.modules.sinusoidal_positional_embedding_layer
:members:
:undoc-members:
:show-inheritance:

Softmax Attention Layer
-----------------------

.. automodule:: pytorch_wrapper.modules.softmax_attention_encoder
:members:
:undoc-members:
:show-inheritance:

Softmax Self Attention Layer
----------------------------

.. automodule:: pytorch_wrapper.modules.softmax_self_attention_encoder
:members:
:undoc-members:
:show-inheritance:

Transformer Encoder
-------------------

.. automodule:: pytorch_wrapper.modules.transformer_encoder
:members:
:undoc-members:
:show-inheritance:

Transformer Encoder Block
-------------------------

.. automodule:: pytorch_wrapper.modules.transformer_encoder_block
:members:
:undoc-members:
:show-inheritance:

0 comments on commit ff95fb1

Please sign in to comment.