BeyondML is a Python package which enables creating sparse multitask artificial neural networks (MANNs) compatible with TensorFlow and PyTorch. This package contains custom layers and utilities to facilitate the training and optimization of models using the Reduction of Sub-Network Neuroplasticity (RSN2) training procedure developed by AI Squared, Inc.
This package is available through PyPi and can be installed via the following command:
pip install beyondml
To install the current version directly from GitHub without cloning, run the following command:
pip install git+https://github.com/Beyond-ML-Labs/BeyondML.git
Alternatively, you can install the package by cloning the repository from GitHub using the following commands:
# clone the repository and cd into it
git clone https://github.com/Beyond-ML-Labs/BeyondML
cd BeyondML
# install the package
pip install .
For those with a Mac with the M1 processor, this package can be installed, but the standard version of TensorFlow is not compatible with the M1 SOC. In order to install a compatible version of TensorFlow, please install the Miniforge conda environment, which utilizes the conda-forge channel only. Once you are using Miniforge, using conda to install TensorFlow in that environment should install the correct version. After installing TensorFlow, the command pip install beyondml
will install the BeyondML package.
For those who are interested in contributing to this project, we first thank you for your interest! Please refer to the CONTRIBUTING.md file in this repository for information about best practices for how to contribute.
In the event you notice a vulnerability within this project, please open a GitHub Issue detailing the vulnerability to report it. In the event you would like to keep the report private, please email [email protected].
To view current capabilities within the BeyondML package, we welcome you to check the BeyondML documentation.
Lists of features slated for this project will be added here.
Below are a list of additional features, bug fixes, and other changes made for each version.
The below version numbers and logged changes refer to the MANN package.
- Small documentation changes
- Added
quantize_model
function - Added
build_transformer_block
andbuild_token_position_embedding_block
functions for transformer functionality - Removed unnecessary imports breaking imports in minimal environments
- Per-task pruning
- Functionality for this feature is implemented, but usage is expected to be incomplete. Note that task gradients have to be passed retrieved and passed to the function directly (helper function available), and that the model has to initially be compiled using a compatible loss function (recommended 'mse') to identify gradients.
- It has been found that this functionality is currently only supported for models with the following layers:
- MaskedConv2D
- MaskedDense
- MultiMaskedDense
- Note also that this functionality does not support cases where layers of an individual model are other TensorFlow models, but supporting this functionality is on the roadmap.
- Iterative training using per-task pruning
- Functionality for this feature is implemented, but there are known bugs when trying to apply this methodology to models with the
MultiMaskedConv2D
layer present
- Functionality for this feature is implemented, but there are known bugs when trying to apply this methodology to models with the
- Support for PyTorch layers
- Support for additional custom objects in the
quantize_model
function - Added tests to the package functionality
- Added auto-generated documentation
The below version numbers and changes refer to the BeyondML package
- Refactored existing MANN repository to rename to BeyondML
- Added the
SparseDense
,SparseConv
,SparseMultiDense
, andSparseMultiConv
layers tobeyondml.tflow.layers
, giving users the functionality to utilize sparse tensors during inference
- Added the
MaskedMultiHeadAttention
,MaskedTransformerEncoderLayer
, andMaskedTransformerDecoderLayer
layers tobeyondml.pt.layers
to add pruning to the transformer architecture - Added
MaskedConv3D
,MultiMaskedConv3D
,MultiConv3D
,MultiMaxPool3D
,SparseConv3D
, andSparseMultiConv3D
layers tobeyondml.tflow.layers
- Added
MaskedConv3D
,MultiMaskedConv3D
,MultiConv3D
,MultiMaxPool3D
,SparseConv3D
,SparseMultiConv3D
, andMultiMaxPool2D
layers tobeyondml.pt.layers
- Added
beyondml.pt
compatibility with more native PyTorch functionality for using models on different devices and datatypes - Added
train_model
function tobeyondml.tflow.utils
- Added
MultitaskNormalization
layer tobeyondml.tflow.layers
andbeyondml.pt.layers
- Updated documentation to use Sphinx
- Updated requirements to use newer version of TensorFlow
- Fixed errors with changes to types of
input_shape
in TensorFlow Keras layers - Fixed errors resulting from model/configuration changes with TensorFlow
- Fixed issues with converting between masked and unmasked models in TensorFlow
- Updated Pytorch implementation of Transformer-based architectures