Skip to content

Commit

Permalink
Merge pull request #107 from tensorops/release_candidate_commits
Browse files Browse the repository at this point in the history
[PR] New masking system and modifications - #106
  • Loading branch information
soran-ghaderi authored May 30, 2023
2 parents 76971b6 + 4a4ada7 commit b9a3e1d
Show file tree
Hide file tree
Showing 38 changed files with 693 additions and 119 deletions.
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __pycache__/

# Distribution / packaging
.Python
build/
#build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -135,4 +135,10 @@ tase.toml
/tase/unknown_errors.txt
.idea
/.idea/
/certs/
/certs/
/docs/source/
/docs/build/doctrees/
*.bats
Makefile
source/
/docs/source/*
29 changes: 29 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

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

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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 = source
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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
20 changes: 20 additions & 0 deletions docs/source/Makefile
Original file line number Diff line number Diff line change
@@ -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)
79 changes: 79 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys

# sys.path.insert(0, os.path.abspath("../../transformerx/"))
from datetime import datetime
from pygments.styles import get_style_by_name

PYTHONPATH = "../../transformerx/"
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "TransformerX"
copyright = "2023, TensorOps"
author = "TensorOps"
release = "v1.0.0-rc"

# style = get_style_by_name("friendly")
# style.background_color = "#f3f2f1"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
# "sphinx_rtd_theme",
"furo",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.mathjax",
"sphinx_markdown_builder",
]

templates_path = ["_templates"]

napoleon_use_rtype = False

napoleon_include_init_with_doc = True
napoleon_google_docstring = True
napoleon_use_param = True
napoleon_use_ivar = True

# pygments_style = "friendly"

language = "english"


exclude_patterns = []


# html_theme = "sphinx_rtd_theme"
html_theme = "furo"
html_title = "TransformerX Documentation"
html_show_sourcelink = False
html_baseurl = "https://github.com/tensorops/transformerx"

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# html_theme = "alabaster"
html_static_path = ["_static"]

html_theme_options = {
"enable_search_shortcuts": True,
"globaltoc_collapse": True,
"prev_next_buttons_location": "both",
# "style_nav_header_background": "#F5A603",
"navigation_depth": 2,
"collapse_navigation": True,
"sticky_navigation": False,
"logo_only": False,
"display_version": True,
"style_external_links": True,
"titles_only": True,
}

napoleon_use_param = False
21 changes: 21 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. TransformerX documentation master file, created by
sphinx-quickstart on Mon May 1 19:41:56 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to TransformerX's documentation!
========================================

.. toctree::
:maxdepth: 4
:caption: Contents:

transformerx


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions docs/source/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TransformerX
============

.. toctree::
:maxdepth: 4

transformerx
4 changes: 4 additions & 0 deletions docs/source/transformerx.data_loader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.data_loader
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.addnorm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.addnorm
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.dot_product_attention.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.dot_product_attention
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.masks.global_attention_mask
:members:
:undoc-members:
:show-inheritance:
15 changes: 15 additions & 0 deletions docs/source/transformerx.layers.masks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
transformerx.layers.masks package
=================================

.. automodule:: transformerx.layers.masks
:members:
:undoc-members:
:show-inheritance:

Submodules
----------

.. toctree::
:maxdepth: 4

transformerx.layers.masks.global_attention_mask
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.multihead_attention.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.multihead_attention
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.positional_encoding.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.positional_encoding
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.positionwise_ffn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.positionwise_ffn
:members:
:undoc-members:
:show-inheritance:
31 changes: 31 additions & 0 deletions docs/source/transformerx.layers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
transformerx.layers package
===========================

.. automodule:: transformerx.layers
:members:
:undoc-members:
:show-inheritance:

Subpackages
-----------

.. toctree::
:maxdepth: 4

transformerx.layers.masks

Submodules
----------

.. toctree::
:maxdepth: 4

transformerx.layers.addnorm
transformerx.layers.dot_product_attention
transformerx.layers.multihead_attention
transformerx.layers.positional_encoding
transformerx.layers.positionwise_ffn
transformerx.layers.transformer_decoder
transformerx.layers.transformer_decoder_block
transformerx.layers.transformer_encoder
transformerx.layers.transformer_encoder_block
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.transformer_decoder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.transformer_decoder
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.transformer_decoder_block.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.transformer_decoder_block
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.transformer_encoder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.transformer_encoder
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/transformerx.layers.transformer_encoder_block.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: transformerx.layers.transformer_encoder_block
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit b9a3e1d

Please sign in to comment.