Skip to content

Commit

Permalink
Merge pull request #21 from ktonal/develop
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
antoinedaurat authored Jun 2, 2021
2 parents ab8848d + 4113260 commit d7a373b
Show file tree
Hide file tree
Showing 90 changed files with 4,302 additions and 2,426 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Upload Python Package
on:
workflow_dispatch:
push:
# branches-ignore: [master, develop]
pull_request:
branches: [master, develop]

jobs:
ci-pipeline:
Expand All @@ -15,7 +12,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.7'
- name: Install dependencies
run: |
sudo apt-get install -y libsndfile-dev
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
*.ipynb_checkpoints*
dist/*
build/*
docs/_build/
*egg-info*
.idea
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# mimikit

`mimikit` is an open-source python package for audio and music data
modeling with neural networks.
The MusIc ModelIng toolKIT (MIMIKIT) is a python package that does Machine Learning with music data.

It contains models out-of-the-box and simple utilities for dealing with audio data.
The aim of mimikit is double : it will lower the barrier to deep-learning for non-developers while providing tools to developers that enable fast experimentation.

-----

## Usage

Check out the [mimikit-notebooks](https://github.com/ktonal/mimikit-notebooks) for examples of client code.
The goal of `mimikit` is to enable you to use referenced and experimental algorithms on data you provide.

`mimikit` is still in early development, details and documentation are on their way.

## License

mimikit is distributed under the terms of the [GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/)


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 = .
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)
8 changes: 8 additions & 0 deletions docs/audios.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
audios
======

this package exposes helper classes for processing, interacting & modeling audio data

.. automodule:: mimikit.audios.fmodules

.. automodule:: mimikit.audios.features
79 changes: 79 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../mimikit'))


# -- Project information -----------------------------------------------------

project = 'mimikit'
copyright = '2021, k-tonal'
author = 'k-tonal'

# The full version, including alpha/beta/rc tags
release = 'v0.1.6'


# -- General configuration ---------------------------------------------------

import sphinx_rtd_theme

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
"sphinx.ext.viewcode",
'sphinx_rtd_theme',
"numpydoc",
# "sphinx.ext.napoleon",
# "sphinx.ext.autosummary"
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

autoclass_content = "class"

# autodoc_default_options = ['no-undoc-members', 'no-inherited-members']
autodoc_mock_imports = ['soundfile', 'jsonschema.compat']
autodoc_typehints = 'description'
autodoc_class_signature = 'separated'
autodoc_typehints_description_target = 'documented'
autosummary_generate = True

numpydoc_show_class_members = False

napoleon_use_ivar = False

napoleon_use_admonition_for_examples = False
37 changes: 37 additions & 0 deletions docs/data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
data
====

.. py:currentmodule:: mimikit.data.database
.. autoclass:: Database
:members:

.. autoclass:: FeatureProxy
:members:

.. py:currentmodule:: mimikit.data.datamodule
.. autoclass:: Getter
:members:
:special-members: __call__


.. autoclass:: AsSlice
:members:

.. autoclass:: AsFramedSlice
:members:

.. autoclass:: Input
:members:

.. autoclass:: Target
:members:

.. autoclass:: DefaultDataset
:members:

.. autoclass:: DataModule
:no-inherited-members:


29 changes: 29 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. mimikit documentation master file, created by
sphinx-quickstart on Fri Jan 8 04:24:18 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
mimikit
=======

.. toctree::
:maxdepth: 2
:caption: Contents:

.. toctree::
:maxdepth: 1
:caption: User Guides


.. toctree::
:maxdepth: 1
:caption: API Reference

audios
data
models
networks

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
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=.
set BUILDDIR=_build

if "%1" == "" goto help

%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.http://sphinx-doc.org/
exit /b 1
)

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

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

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

exposes well-known and experimental models as :class:`pytorch_lightning.LightningModule`

.. py:currentmodule:: mimikit.models
.. autoclass:: SampleRNN
:no-inherited-members:


.. autoclass:: FreqNet
:no-inherited-members:
15 changes: 15 additions & 0 deletions docs/networks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
networks
========

exposes networks as pure :class:`torch.nn.Module`.

.. py:currentmodule:: mimikit.networks
.. autoclass:: FreqNetNetwork
:no-inherited-members:

.. autoclass:: SampleRNNNetwork
:no-inherited-members:

.. autoclass:: WNNetwork
:no-inherited-members:
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
numpydoc
sphinx_rtd_theme
30 changes: 25 additions & 5 deletions mimikit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
__version__ = '0.1.10'
__version__ = '0.2.0'

from . import audios
from . import connectors
from . import data
from . import extract
from . import midi
from . import models
from . import modules
from . import networks

from .audios import *
from .connectors import *
from .data import *
from .extract import *
from .midi import *
from .models.parts import *
from .models import *
from .modules import *
from .networks import *

from .file_walker import *
from .get_trainer import *
from .utils import *


from .kit import get_trainer
from .connectors.neptune import NeptuneConnector
from .data import Database
from .utils import show, audio, signal
3 changes: 3 additions & 0 deletions mimikit/_make_notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import nbformat as nbf

__all__ = []
Empty file added mimikit/abstract/__init__.py
Empty file.
45 changes: 45 additions & 0 deletions mimikit/abstract/features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import dataclasses as dtc

import numpy as np
from ..data import Feature
from ..extract import from_recurrence_matrix


@dtc.dataclass
class SegmentLabels(Feature):
__ext__ = 'none'

input_key: str = 'x'
L: int = 6
k: int = None
sym: bool = True
bandwidth: float = 1.
thresh: float = 0.2
min_dur: int = 4

@property
def params(self):
return {'input_key': self.input_key}

@property
def encoders(self):
return {np.ndarray: lambda X: \
from_recurrence_matrix(X.T, L=self.L, k=self.k, sym=self.sym,
bandwidth=self.bandwidth, thresh=self.thresh,
min_dur=self.min_dur)}

def post_create(self, db, schema_key):
return getattr(db, schema_key).regions.to_labels()


@dtc.dataclass
class FilesLabels(Feature):
__ext__ = 'none'
input_key: str = 'x'

@property
def encoders(self):
return {np.ndarray: lambda x: np.ones((x.shape[0]))}

def post_create(self, db, schema_key):
return getattr(db, schema_key).files.to_labels()
5 changes: 5 additions & 0 deletions mimikit/audios/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .features import *
from .fmodules import *


__all__ = [_ for _ in dir() if not _.startswith("_")]
Loading

0 comments on commit d7a373b

Please sign in to comment.