Commit 37bd3c00 authored by M. François's avatar M. François

Public release

parent 9a284496
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>
...@@ -8,24 +8,12 @@ NeuralFilterCell ...@@ -8,24 +8,12 @@ NeuralFilterCell
This module implements a basic trainable all-pole first order filter This module implements a basic trainable all-pole first order filter
using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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) class neural_filters.neural_filter.NeuralFilter(hidden_size)
A trainable first-order all-pole filter \frac{1}{1 - P z^{-1}} A trainable first-order all-pole filter \frac{1}{1 - P z^{-1}}
...@@ -51,24 +39,12 @@ NeuralFilter2R ...@@ -51,24 +39,12 @@ NeuralFilter2R
This module implements a trainable all-pole second order filter with This module implements a trainable all-pole second order filter with
real poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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) class neural_filters.neural_filter_2R.NeuralFilter2R(hidden_size)
A trainable second-order all-(real)pole filter \frac{1}{1 - P_{1} A trainable second-order all-(real)pole filter \frac{1}{1 - P_{1}
...@@ -95,24 +71,12 @@ NeuralFilter2CD ...@@ -95,24 +71,12 @@ NeuralFilter2CD
This module implements a trainable critically damped all-pole second This module implements a trainable critically damped all-pole second
order filter with real poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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) class neural_filters.neural_filter_2CD.NeuralFilter2CD(hidden_size)
A trainable second-order critically damped all-pole filter A trainable second-order critically damped all-pole filter
...@@ -139,24 +103,12 @@ NeuralFilter2CC ...@@ -139,24 +103,12 @@ NeuralFilter2CC
This module implements a trainable all-pole second order filter with This module implements a trainable all-pole second order filter with
complex conjugate poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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) class neural_filters.neural_filter_2CC.NeuralFilter2CC(hidden_size)
A trainable second-order all-pole filter \frac{1}{1 - 2 P A trainable second-order all-pole filter \frac{1}{1 - 2 P
......
...@@ -14,6 +14,9 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . ...@@ -14,6 +14,9 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
all:
make doc
.PHONY: help .PHONY: help
help: help:
@echo "Please use \`make <target>' where <target> is one of" @echo "Please use \`make <target>' where <target> is one of"
......
...@@ -53,7 +53,7 @@ master_doc = 'index' ...@@ -53,7 +53,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Neural Filters' project = u'Neural Filters'
copyright = u'2018, Idiap Research Institute' copyright = u'2019, Idiap Research Institute'
author = u'Francois Marelli' author = u'Francois Marelli'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
......
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 EPSILON = 1e-6
INIT_MODULUS = 0.95 INIT_MODULUS = 0.95
MIN_ANGLE = 0 MIN_ANGLE = 0
MAX_ANGLE = numpy.pi / 2 MAX_ANGLE = np.pi / 2
def asig(x): def asig(x):
...@@ -13,7 +25,7 @@ def asig(x): ...@@ -13,7 +25,7 @@ def asig(x):
x[x == 1] = 1 - EPSILON x[x == 1] = 1 - EPSILON
x[x == 0] = EPSILON x[x == 0] = EPSILON
return -numpy.log((1 / x) - 1) return -np.log((1 / x) - 1)
def atanh(x): def atanh(x):
...@@ -22,7 +34,7 @@ def atanh(x): ...@@ -22,7 +34,7 @@ def atanh(x):
x[abs(x) == 1] *= (1 - EPSILON) x[abs(x) == 1] *= (1 - EPSILON)
return numpy.arctanh(x) return np.arctanh(x)
from .neural_filter import * from .neural_filter import *
......
...@@ -5,24 +5,12 @@ NeuralFilterCell ...@@ -5,24 +5,12 @@ NeuralFilterCell
This module implements a basic trainable all-pole first order filter using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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 numpy as np
......
...@@ -5,30 +5,19 @@ NeuralFilter2CC ...@@ -5,30 +5,19 @@ NeuralFilter2CC
This module implements a trainable all-pole second order filter with complex conjugate poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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 numpy as np
import torch import torch
from torch.nn import Parameter from torch.nn import Parameter
from torch.nn._functions.rnn import Recurrent, VariableRecurrent from torch.nn._functions.rnn import Recurrent, VariableRecurrent
from torch.nn import LSTMCell
from torch.nn.utils.rnn import PackedSequence from torch.nn.utils.rnn import PackedSequence
from . import MIN_ANGLE, MAX_ANGLE, INIT_MODULUS, asig, atanh from . import MIN_ANGLE, MAX_ANGLE, INIT_MODULUS, asig, atanh
......
...@@ -5,24 +5,12 @@ NeuralFilter2CD ...@@ -5,24 +5,12 @@ NeuralFilter2CD
This module implements a trainable critically damped all-pole second order filter with real poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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 numpy as np
......
...@@ -5,24 +5,12 @@ NeuralFilter2R ...@@ -5,24 +5,12 @@ NeuralFilter2R
This module implements a trainable all-pole second order filter with real poles using pyTorch 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> Written by Francois Marelli <Francois.Marelli@idiap.ch>
This file is part of neural_filters. 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 numpy as np
......
from setuptools import setup, find_packages from setuptools import setup
setup( setup(
name='neural-filters', name='neural-filters',
version='1.2.1', version='0.1',
description='Linear filters for neural networks in pyTorch', description='Linear filters for neural networks in pyTorch',
author='François Marelli (Idiap research institute)', author='François Marelli (Idiap research institute)',
author_email='francois.marelli@idiap.ch', author_email='francois.marelli@idiap.ch',
...@@ -10,12 +10,13 @@ setup( ...@@ -10,12 +10,13 @@ setup(
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: GNU GPL v3', 'License :: OSI Approved :: MIT',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
], ],
packages=['neural_filters'], packages=['neural_filters'],
install_requires=[ install_requires=[
'torch>=0.4.0', 'torch>=0.4.0,<1.0',
'numpy', 'numpy',
], ],
zip_safe=True, zip_safe=True,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment