diff --git a/README.md b/README.md index 9d97dc7e05dc4c24452e59c02b6a553528bc514f..df9d4a5820a4a67883d9e83c1af58cd3de5cdfd0 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -neural_filters is a PyTorch toolbox implementing linear IIR filters as recurrent neural units +This package implements Neural Filters related to the following paper: + + "François Marelli, Bastian Schnell, Hervé Bourlard, Thierry Dutoit, and Philip N. Garner. An end-to-end network to synthesize intonation using a generalized command response model. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing, Brighton, UK, May 2019" + +Neural Filters are linear IIR filters integrated in the PyTorch framework, which can be interfaced with neural networks and trained by gradient descent. + +(c) Idiap Research Institute, Francois Marelli <francois.marelli@idiap.ch> diff --git a/docs/README.rst b/docs/README.rst index 68f99317c0ec8e183abf33bb705534551a8e7d18..cdbc4d66c75627dead9dbc0fdb9643a3c23bb579 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -8,24 +8,12 @@ NeuralFilterCell This module implements a basic trainable all-pole first order filter using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - class neural_filters.neural_filter.NeuralFilter(hidden_size) A trainable first-order all-pole filter \frac{1}{1 - P z^{-1}} @@ -51,24 +39,12 @@ NeuralFilter2R This module implements a trainable all-pole second order filter with real poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - class neural_filters.neural_filter_2R.NeuralFilter2R(hidden_size) A trainable second-order all-(real)pole filter \frac{1}{1 - P_{1} @@ -95,24 +71,12 @@ NeuralFilter2CD This module implements a trainable critically damped all-pole second order filter with real poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - class neural_filters.neural_filter_2CD.NeuralFilter2CD(hidden_size) A trainable second-order critically damped all-pole filter @@ -139,24 +103,12 @@ NeuralFilter2CC This module implements a trainable all-pole second order filter with complex conjugate poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - class neural_filters.neural_filter_2CC.NeuralFilter2CC(hidden_size) A trainable second-order all-pole filter \frac{1}{1 - 2 P diff --git a/docs/sphinx/Makefile b/docs/sphinx/Makefile index 9f9de0ec5e123084f184a573b6b40013d297725e..c930ea93f30f0094bd6bc5e2af90385e282e7936 100644 --- a/docs/sphinx/Makefile +++ b/docs/sphinx/Makefile @@ -14,6 +14,9 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +all: + make doc + .PHONY: help help: @echo "Please use \`make <target>' where <target> is one of" diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index e85360a073254362a14af3908fe50bf0ae091c8e..8ef4b00a4327d1b1bc458aeb3644ff3225ce8dec 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -53,7 +53,7 @@ master_doc = 'index' # General information about the project. project = u'Neural Filters' -copyright = u'2018, Idiap Research Institute' +copyright = u'2019, Idiap Research Institute' author = u'Francois Marelli' # The version info for the project you're documenting, acts as replacement for diff --git a/neural_filters/__init__.py b/neural_filters/__init__.py index b410f32f63a77d3342962a678f7967d1a54fb9b3..269067ab0fb960f0a473925d4d3356de50e6b755 100644 --- a/neural_filters/__init__.py +++ b/neural_filters/__init__.py @@ -1,9 +1,21 @@ -import numpy +""" +neural_filters +************** + +Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ + +Written by Francois Marelli <Francois.Marelli@idiap.ch> + +This file is part of neural_filters. + +""" + +import numpy as np EPSILON = 1e-6 INIT_MODULUS = 0.95 MIN_ANGLE = 0 -MAX_ANGLE = numpy.pi / 2 +MAX_ANGLE = np.pi / 2 def asig(x): @@ -13,7 +25,7 @@ def asig(x): x[x == 1] = 1 - EPSILON x[x == 0] = EPSILON - return -numpy.log((1 / x) - 1) + return -np.log((1 / x) - 1) def atanh(x): @@ -22,7 +34,7 @@ def atanh(x): x[abs(x) == 1] *= (1 - EPSILON) - return numpy.arctanh(x) + return np.arctanh(x) from .neural_filter import * diff --git a/neural_filters/neural_filter.py b/neural_filters/neural_filter.py index aa558d45db95c5242cc9779488a3247b4f245e29..a7550c23ab2770aca8b991920cfd3c71b2e67d9c 100644 --- a/neural_filters/neural_filter.py +++ b/neural_filters/neural_filter.py @@ -5,24 +5,12 @@ NeuralFilterCell This module implements a basic trainable all-pole first order filter using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - """ import numpy as np diff --git a/neural_filters/neural_filter_2CC.py b/neural_filters/neural_filter_2CC.py index 57d0caa995085dd4c9373e7801c1dcb7750839ce..6e2e294677b8b9219641d20b491107809cd38e05 100644 --- a/neural_filters/neural_filter_2CC.py +++ b/neural_filters/neural_filter_2CC.py @@ -5,30 +5,19 @@ NeuralFilter2CC This module implements a trainable all-pole second order filter with complex conjugate poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - """ import numpy as np import torch from torch.nn import Parameter from torch.nn._functions.rnn import Recurrent, VariableRecurrent +from torch.nn import LSTMCell from torch.nn.utils.rnn import PackedSequence from . import MIN_ANGLE, MAX_ANGLE, INIT_MODULUS, asig, atanh diff --git a/neural_filters/neural_filter_2CD.py b/neural_filters/neural_filter_2CD.py index 8d7d03f269363ec8302188b0935bf801e0667fd6..f73cfd9fda4b1c5c9f65ab5d583e14bc3a43deed 100644 --- a/neural_filters/neural_filter_2CD.py +++ b/neural_filters/neural_filter_2CD.py @@ -5,24 +5,12 @@ NeuralFilter2CD This module implements a trainable critically damped all-pole second order filter with real poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - """ import numpy as np diff --git a/neural_filters/neural_filter_2R.py b/neural_filters/neural_filter_2R.py index 9cc2eaafda1e4359826bfc81d68876c78d6d012e..70d02bb9d0403f98d193e0edf44673879ffb7908 100644 --- a/neural_filters/neural_filter_2R.py +++ b/neural_filters/neural_filter_2R.py @@ -5,24 +5,12 @@ NeuralFilter2R This module implements a trainable all-pole second order filter with real poles using pyTorch -Copyright (c) 2018 Idiap Research Institute, http://www.idiap.ch/ +Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ Written by Francois Marelli <Francois.Marelli@idiap.ch> This file is part of neural_filters. -neural_filters is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3 as -published by the Free Software Foundation. - -neural_filters is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with neural_filters. If not, see <http://www.gnu.org/licenses/>. - """ import numpy as np diff --git a/setup.py b/setup.py index 8d1de4b8658d6d8d9b55b73e6d32887f22f14afe..d37047e05931bfd1000659a05893d674cf56a4da 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ -from setuptools import setup, find_packages +from setuptools import setup setup( name='neural-filters', - version='1.2.1', + version='0.1', description='Linear filters for neural networks in pyTorch', author='François Marelli (Idiap research institute)', author_email='francois.marelli@idiap.ch', @@ -10,12 +10,13 @@ setup( classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU GPL v3', + 'License :: OSI Approved :: MIT', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', ], packages=['neural_filters'], install_requires=[ - 'torch>=0.4.0', + 'torch>=0.4.0,<1.0', 'numpy', ], zip_safe=True,