From 37bd3c00fee486696a110f2a2ee04aed9581a6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fran=C3=A7ois?= <fran.marelli@gmail.com> Date: Mon, 6 May 2019 17:23:35 +0200 Subject: [PATCH] Public release --- README.md | 8 ++++- docs/README.rst | 56 +++-------------------------- docs/sphinx/Makefile | 3 ++ docs/sphinx/conf.py | 2 +- neural_filters/__init__.py | 20 ++++++++--- neural_filters/neural_filter.py | 14 +------- neural_filters/neural_filter_2CC.py | 15 ++------ neural_filters/neural_filter_2CD.py | 14 +------- neural_filters/neural_filter_2R.py | 14 +------- setup.py | 9 ++--- 10 files changed, 41 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 9d97dc7..df9d4a5 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 68f9931..cdbc4d6 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 9f9de0e..c930ea9 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 e85360a..8ef4b00 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 b410f32..269067a 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 aa558d4..a7550c2 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 57d0caa..6e2e294 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 8d7d03f..f73cfd9 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 9cc2eaa..70d02bb 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 8d1de4b..d37047e 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, -- GitLab