mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
BREAKING: switch to uv, namespace package, Python 3.10+, remove old CLI
This commit is contained in:
1 parent
d9389defa7
commit
93ad8b90ca
155 files changed
+15125
-3529
No files matched your search
@@ -1,4 +1,2 @@
|
||||
pyannote/audio/_version.py export-subst
|
||||
notebooks/* linguist-documentation
|
||||
tutorials/* linguist-documentation
|
||||
versioneer.py linguist-vendored
|
||||
@@ -1,3 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [hbredin]
|
||||
+16
-21
@@ -7,32 +7,27 @@ on:
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
python-version: ["3.9"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .
|
||||
pip install -r doc/requirements.txt
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --extra doc
|
||||
|
||||
- name: Build documentation
|
||||
run: |
|
||||
make --directory=doc html
|
||||
touch ./doc/build/html/.nojekyll
|
||||
- name: Deploy
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
PUBLISH_DIR: ./doc/build/html
|
||||
SCRIPT_MODE: true
|
||||
run: |
|
||||
wget https://raw.githubusercontent.com/peaceiris/actions-gh-pages/v2/entrypoint.sh
|
||||
bash ./entrypoint.sh
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./doc/build/html
|
||||
@@ -1,27 +0,0 @@
|
||||
name: PyPI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload dist/*
|
||||
@@ -0,0 +1,125 @@
|
||||
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build distribution 📦
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: ".python-version"
|
||||
- name: Build
|
||||
run: uv build
|
||||
- name: Store the distribution packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
|
||||
publish-to-pypi:
|
||||
name: >-
|
||||
Publish Python 🐍 distribution 📦 to PyPI
|
||||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
||||
needs:
|
||||
- build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Download all the dists
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
- name: Publish distribution 📦 to PyPI
|
||||
run: uv publish --trusted-publishing always --publish-url https://upload.pypi.org/legacy/
|
||||
|
||||
|
||||
github-release:
|
||||
name: >-
|
||||
Sign the Python 🐍 distribution 📦 with Sigstore
|
||||
and upload them to GitHub Release
|
||||
needs:
|
||||
- publish-to-pypi
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write # IMPORTANT: mandatory for making GitHub Releases
|
||||
id-token: write # IMPORTANT: mandatory for sigstore
|
||||
|
||||
steps:
|
||||
- name: Download all the dists
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
- name: Sign the dists with Sigstore
|
||||
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
||||
with:
|
||||
inputs: >-
|
||||
./dist/*.tar.gz
|
||||
./dist/*.whl
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: >-
|
||||
gh release create
|
||||
"$GITHUB_REF_NAME"
|
||||
--repo "$GITHUB_REPOSITORY"
|
||||
--notes ""
|
||||
- name: Upload artifact signatures to GitHub Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
# Upload to GitHub Release using the `gh` CLI.
|
||||
# `dist/` contains the built packages, and the
|
||||
# sigstore-produced signatures and certificates.
|
||||
run: >-
|
||||
gh release upload
|
||||
"$GITHUB_REF_NAME" dist/**
|
||||
--repo "$GITHUB_REPOSITORY"
|
||||
|
||||
# publish-to-testpypi:
|
||||
# name: Publish Python 🐍 distribution 📦 to TestPyPI
|
||||
# needs:
|
||||
# - build
|
||||
# runs-on: ubuntu-latest
|
||||
#
|
||||
# environment:
|
||||
# name: testpypi
|
||||
#
|
||||
# permissions:
|
||||
# id-token: write # IMPORTANT: mandatory for trusted publishing
|
||||
#
|
||||
# steps:
|
||||
# - name: Download all the dists
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: python-package-distributions
|
||||
# path: dist/
|
||||
# - name: Install uv
|
||||
# uses: astral-sh/setup-uv@v5
|
||||
# with:
|
||||
# enable-cache: true
|
||||
# cache-dependency-glob: uv.lock
|
||||
# - name: Publish distribution 📦 to PyPI
|
||||
# run: uv publish --trusted-publishing always --publish-url https://test.pypi.org/legacy/
|
||||
+25
-25
@@ -1,33 +1,33 @@
|
||||
name: Tests
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
branches:
|
||||
- develop
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
- release/*
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
timeout-minutes: 20
|
||||
runs-on: ${{ matrix.os }}
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
python-version: ["3.9", "3.10", "3.11"]
|
||||
python-version:
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
env:
|
||||
UV_PYTHON: ${{ matrix.python-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install libsndfile
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsndfile1
|
||||
- name: Install pyannote.audio
|
||||
run: |
|
||||
pip install -e .[dev,testing]
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest -k "not test_cli.py"
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: Run tests
|
||||
run: uv run --extra test pytest
|
||||
@@ -1,33 +0,0 @@
|
||||
name: CLI tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
timeout-minutes: 20
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
python-version: ["3.10"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install libsndfile
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsndfile1
|
||||
- name: Install pyannote.audio
|
||||
run: |
|
||||
pip install -e .[dev,testing,cli]
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest tests/test_cli.py
|
||||
@@ -0,0 +1 @@
|
||||
3.10
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
# Changelog
|
||||
# CHANGELOG
|
||||
|
||||
## develop
|
||||
|
||||
@@ -18,6 +18,8 @@ Clipping and speaker/source alignment issues in speech separation pipeline have
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- BREAKING(setup): drop support to `Python` < 3.10
|
||||
- BREAKING(chore): switch to native namespace package
|
||||
- BREAKING(hub): rename `use_auth_token` to `token`
|
||||
- BREAKING(cache): rely on `huggingface_hub` caching directory (`PYANNOTE_CACHE` is no longer used)
|
||||
- BREAKING(inference): `Inference` now only supports already instantiated models
|
||||
@@ -25,6 +27,7 @@ Clipping and speaker/source alignment issues in speech separation pipeline have
|
||||
- BREAKING(task): drop support for `warm_up` option in `SpeakerDiarization` task
|
||||
- BREAKING(task): drop support for `weigh_by_cardinality` option in `SpeakerDiarization` task
|
||||
- BREAKING(task): drop support for `vad_loss` option in `SpeakerDiarization` task
|
||||
- BREAKING(cli): remove deprecated `pyannote-audio-train` CLI
|
||||
|
||||
### New features
|
||||
|
||||
@@ -42,6 +45,7 @@ Clipping and speaker/source alignment issues in speech separation pipeline have
|
||||
|
||||
- improve(model): improve WavLM (un)freezing support for `SSeRiouSS` architecture ([@clement-pages](https://github.com/clement-pages/))
|
||||
- improve(task): improve `SpeakerDiarization` training with manual optimization ([@clement-pages](https://github.com/clement-pages/))
|
||||
- improve(setup): switch to `uv`
|
||||
|
||||
### Fixes
|
||||
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
recursive-include pyannote *.py
|
||||
recursive-include pyannote *.yaml
|
||||
recursive-include pyannote *.wav
|
||||
recursive-include pyannote *.rttm
|
||||
recursive-include src/pyannote *.py
|
||||
recursive-include src/pyannote *.yaml
|
||||
recursive-include src/pyannote *.wav
|
||||
recursive-include src/pyannote *.rttm
|
||||
global-exclude *.pyc
|
||||
global-exclude __pycache__
|
||||
@@ -1,5 +0,0 @@
|
||||
coverage:
|
||||
status:
|
||||
patch:
|
||||
default:
|
||||
enabled: false
|
||||
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = pyannoteaudio
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
uv run --extra doc $(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
|
||||
uv run --extra doc $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
@@ -1,63 +0,0 @@
|
||||
"""
|
||||
This script will generate the rst docs for the api
|
||||
"""
|
||||
|
||||
import os
|
||||
from os import path
|
||||
|
||||
bp = breakpoint
|
||||
|
||||
|
||||
def capitalise(s):
|
||||
news = ""
|
||||
for word in s.split("_"):
|
||||
news += word.capitalize()
|
||||
return news
|
||||
|
||||
|
||||
def process_dir(level, p):
|
||||
md = ""
|
||||
basename = path.basename(p)
|
||||
|
||||
title = capitalise(basename)
|
||||
md += f"{'#'*level} {title}\n\n"
|
||||
subdirs = os.listdir(p)
|
||||
|
||||
for f in subdirs:
|
||||
m = path.join(subdir, f)
|
||||
if path.isdir(m):
|
||||
md += process_dir(level + 1, path.join(p, f))
|
||||
else:
|
||||
if "__" in f:
|
||||
continue
|
||||
module = m[3:].replace("/", ".")[:-3]
|
||||
md += f"""
|
||||
```eval_rst
|
||||
.. automodule:: {module}
|
||||
:members:
|
||||
|
||||
```
|
||||
|
||||
"""
|
||||
return md
|
||||
|
||||
|
||||
DIR = "../pyannote/audio"
|
||||
|
||||
for module in os.listdir(DIR):
|
||||
# Each folder will become and rst file
|
||||
# Each file/folder will have a # prepended to it
|
||||
# Recursively we will add another # each level
|
||||
|
||||
# Initialise Markdown
|
||||
md = ""
|
||||
|
||||
subdir = path.join(DIR, module)
|
||||
|
||||
# Skip if not directory
|
||||
if not path.isdir(subdir) or "__" in module:
|
||||
continue
|
||||
|
||||
md += process_dir(1, subdir)
|
||||
with open(f"./source/api/{module}.md", "w") as f:
|
||||
f.write(md)
|
||||
@@ -1,4 +0,0 @@
|
||||
ipython==8.10.0
|
||||
recommonmark
|
||||
Sphinx==3.0.4
|
||||
sphinx_rtd_theme==0.4.3
|
||||
@@ -0,0 +1,196 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# pyannote.audio documentation build configuration file, created by
|
||||
# sphinx-quickstart on Tue Jan 24 15:45:55 2017.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
# 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.
|
||||
#
|
||||
|
||||
# allow pyannote.audio import
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath("../.."))
|
||||
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# 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.napoleon",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.todo",
|
||||
"sphinx.ext.coverage",
|
||||
"sphinx.ext.mathjax",
|
||||
"sphinx.ext.viewcode",
|
||||
"sphinx.ext.githubpages",
|
||||
]
|
||||
|
||||
|
||||
# Napoleon settings
|
||||
napoleon_google_docstring = True
|
||||
napoleon_numpy_docstring = True
|
||||
napoleon_include_init_with_doc = False
|
||||
napoleon_include_private_with_doc = False
|
||||
napoleon_include_special_with_doc = False
|
||||
napoleon_use_admonition_for_examples = False
|
||||
napoleon_use_admonition_for_notes = False
|
||||
napoleon_use_admonition_for_references = False
|
||||
napoleon_use_ivar = False
|
||||
napoleon_use_param = True
|
||||
napoleon_use_rtype = True
|
||||
napoleon_use_keyword = True
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ["_templates"]
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = {".rst": "restructuredtext"}
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = "index"
|
||||
|
||||
# General information about the project.
|
||||
project = "pyannote.audio"
|
||||
copyright = "2017, CNRS"
|
||||
author = "Hervé Bredin"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
|
||||
import pyannote.audio # noqa
|
||||
|
||||
# The short X.Y version.
|
||||
version = pyannote.audio.__version__.split("+")[0]
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = pyannote.audio.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = "en"
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = []
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = "sphinx"
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
|
||||
|
||||
# -- 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"
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
# 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"]
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = "pyannoteaudiodoc"
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(
|
||||
master_doc,
|
||||
"pyannoteaudio.tex",
|
||||
"pyannote.audio Documentation",
|
||||
"Hervé Bredin",
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [(master_doc, "pyannoteaudio", "pyannote.audio Documentation", [author], 1)]
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(
|
||||
master_doc,
|
||||
"pyannoteaudio",
|
||||
"pyannote.audio Documentation",
|
||||
author,
|
||||
"pyannoteaudio",
|
||||
"One line description of project.",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/", None),
|
||||
"pyannote.core": ("https://pyannote.github.io/pyannote-core", None),
|
||||
"pyannote.database": ("https://pyannote.github.io/pyannote-database", None),
|
||||
"pyannote.metrics": ("https://pyannote.github.io/pyannote-metrics", None),
|
||||
"pyannote.pipeline": ("https://pyannote.github.io/pyannote-pipeline", None),
|
||||
}
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
|
||||
##############
|
||||
pyannote.audio
|
||||
##############
|
||||
|
||||
`pyannote.audio` is an open-source Python library that provides neural building blocks for speaker diarization.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
::
|
||||
|
||||
$ conda create -n pyannote python=3.10
|
||||
$ conda activate pyannote
|
||||
$ pip install pyannote.audio
|
||||
|
||||
|
||||
API documentation
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
`pyannote.audio` is an open-source toolkit for state-of-the-art speaker diarization.
|
||||
@@ -1,10 +0,0 @@
|
||||
name: pyannote-audio
|
||||
channels:
|
||||
- defaults
|
||||
- conda-forge
|
||||
dependencies:
|
||||
- python==3.8.5
|
||||
- libsndfile==1.0.28
|
||||
- pip>=20.2
|
||||
- pip:
|
||||
- -r requirements.txt
|
||||
@@ -29,7 +29,7 @@
|
||||
"source": [
|
||||
"from pyannote.audio.models.segmentation.debug import SimpleSegmentationModel\n",
|
||||
"from pyannote.audio.models.embedding.debug import SimpleEmbeddingModel\n",
|
||||
"import pytorch_lightning as pl"
|
||||
"import lightning.pytorch as pl"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
__import__("pkg_resources").declare_namespace(__name__)
|
||||
@@ -1,27 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020-2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from .pretrained import pretrained
|
||||
|
||||
__all__ = [
|
||||
"pretrained",
|
||||
]
|
||||
@@ -1,31 +0,0 @@
|
||||
# @package _group_
|
||||
|
||||
run:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
|
||||
sweep:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
subdir: ${hydra.job.num}
|
||||
|
||||
output_subdir: ""
|
||||
|
||||
help:
|
||||
app_name: pyannote-audio-train
|
||||
|
||||
# Help header, customize to describe your app to your users
|
||||
header: == ${hydra.help.app_name} ==
|
||||
|
||||
footer: |-
|
||||
Powered by Hydra (https://hydra.cc)
|
||||
Use --hydra-help to view Hydra specific help
|
||||
|
||||
template: |-
|
||||
${hydra.help.header}
|
||||
|
||||
pyannote-audio-train protocol={protocol_name}
|
||||
task={task} task.param=...
|
||||
model={model} model.param=...
|
||||
optimizer={optimizer} optimizer.param=...
|
||||
scheduler={scheduler} scheduler.param=...
|
||||
|
||||
${hydra.help.footer}
|
||||
@@ -1,101 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022- CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import hydra
|
||||
from omegaconf import DictConfig
|
||||
from pyannote.database import FileFinder, ProtocolFile, registry
|
||||
from rich.progress import Progress
|
||||
|
||||
from pyannote.audio import Inference, Model
|
||||
from pyannote.audio.pipelines.utils import get_devices
|
||||
from pyannote.audio.utils.metric import DiscreteDiarizationErrorRate
|
||||
from pyannote.audio.utils.signal import binarize
|
||||
|
||||
|
||||
@hydra.main(config_path="evaluate_config", config_name="config")
|
||||
def evaluate(cfg: DictConfig) -> Optional[float]:
|
||||
|
||||
# load pretrained model
|
||||
(device,) = get_devices(needs=1)
|
||||
model = Model.from_pretrained(cfg.model, device=device)
|
||||
|
||||
# load databases into registry if it was specified
|
||||
if "registry" in cfg:
|
||||
for database_yml in cfg.registry.split(","):
|
||||
registry.load_database(database_yml)
|
||||
|
||||
# load evaluation files
|
||||
protocol = registry.get_protocol(
|
||||
cfg.protocol, preprocessors={"audio": FileFinder()}
|
||||
)
|
||||
|
||||
files = list(getattr(protocol, cfg.subset)())
|
||||
|
||||
# load evaluation metric
|
||||
metric = DiscreteDiarizationErrorRate()
|
||||
|
||||
with Progress() as progress:
|
||||
|
||||
main_task = progress.add_task(protocol.name, total=len(files))
|
||||
file_task = progress.add_task("Processing", total=1.0)
|
||||
|
||||
def progress_hook(completed: Optional[int] = None, total: Optional[int] = None):
|
||||
progress.update(file_task, completed=completed / total)
|
||||
|
||||
inference = Inference(model, device=device)
|
||||
warm_up = cfg.warm_up / inference.duration
|
||||
|
||||
def hypothesis(file: ProtocolFile):
|
||||
return Inference.trim(
|
||||
binarize(inference(file, hook=progress_hook)),
|
||||
warm_up=(warm_up, warm_up),
|
||||
)
|
||||
|
||||
for file in files:
|
||||
progress.update(file_task, description=file["uri"])
|
||||
reference = file["annotation"]
|
||||
uem = file["annotated"]
|
||||
_ = metric(reference, hypothesis(file), uem=uem)
|
||||
progress.advance(main_task)
|
||||
|
||||
report = metric.report(display=False)
|
||||
|
||||
with open("report.txt", "w") as f:
|
||||
|
||||
f.write(f"# Model: {cfg.model}\n")
|
||||
f.write(f"# Protocol: {protocol.name}\n")
|
||||
f.write(f"# Subset: {cfg.subset}\n")
|
||||
f.write("\n")
|
||||
report = report.to_string(
|
||||
index=True,
|
||||
sparsify=False,
|
||||
justify="right",
|
||||
float_format=lambda f: "{0:.2f}".format(f),
|
||||
)
|
||||
f.write(f"{report}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
evaluate()
|
||||
@@ -1,21 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020-2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
@@ -1,7 +0,0 @@
|
||||
model: ???
|
||||
protocol: ???
|
||||
warm_up: 0.0
|
||||
subset: test
|
||||
|
||||
defaults:
|
||||
- hydra: default
|
||||
@@ -1,31 +0,0 @@
|
||||
# @package _group_
|
||||
|
||||
run:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
|
||||
sweep:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
subdir: ${hydra.job.num}
|
||||
|
||||
output_subdir: ""
|
||||
|
||||
help:
|
||||
app_name: pyannote-audio-eval
|
||||
|
||||
# Help header, customize to describe your app to your users
|
||||
header: == ${hydra.help.app_name} ==
|
||||
|
||||
footer: |-
|
||||
Powered by Hydra (https://hydra.cc)
|
||||
Use --hydra-help to view Hydra specific help
|
||||
|
||||
template: |-
|
||||
${hydra.help.header}
|
||||
|
||||
pyannote-audio-eval registry={path_to_database.yml}
|
||||
protocol={protocol_name}
|
||||
subset={test | development | train}
|
||||
model={path_to_pretrained_model}
|
||||
warm_up={warm_up_duration_in_seconds}
|
||||
|
||||
${hydra.help.footer}
|
||||
@@ -1,66 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from torch.optim import Optimizer
|
||||
from torch.optim.lr_scheduler import (
|
||||
CosineAnnealingWarmRestarts as _CosineAnnealingWarmRestarts,
|
||||
)
|
||||
|
||||
|
||||
def CosineAnnealingWarmRestarts(
|
||||
optimizer: Optimizer,
|
||||
min_lr: float = 1e-8,
|
||||
max_lr: float = 1e-3,
|
||||
patience: int = 1,
|
||||
num_batches_per_epoch: Optional[int] = None,
|
||||
**kwargs,
|
||||
):
|
||||
"""Wrapper around CosineAnnealingWarmRestarts
|
||||
|
||||
Parameters
|
||||
----------
|
||||
optimizer : Optimizer
|
||||
Optimizer
|
||||
min_lr : float, optional
|
||||
Defaults to 1e-8.
|
||||
max_lr : float, optional
|
||||
Defaults to 1e-3
|
||||
patience : int, optional
|
||||
Number of epochs per cycle. Defaults to 1.
|
||||
num_batches_per_epoch : int, optional
|
||||
Number of batches per epoch.
|
||||
"""
|
||||
|
||||
# initialize optimizer lr to max_lr
|
||||
for g in optimizer.param_groups:
|
||||
g["lr"] = max_lr
|
||||
|
||||
num_steps = patience * num_batches_per_epoch
|
||||
|
||||
return {
|
||||
"scheduler": _CosineAnnealingWarmRestarts(
|
||||
optimizer, num_steps, eta_min=min_lr, T_mult=2
|
||||
),
|
||||
"interval": "step",
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from torch.optim import Optimizer
|
||||
from torch.optim.lr_scheduler import CyclicLR as _CyclicLR
|
||||
|
||||
|
||||
def CyclicLR(
|
||||
optimizer: Optimizer,
|
||||
min_lr: float = 1e-8,
|
||||
max_lr: float = 1e-3,
|
||||
mode: str = "triangular2",
|
||||
patience: int = 50,
|
||||
num_batches_per_epoch: Optional[int] = None,
|
||||
**kwargs,
|
||||
):
|
||||
"""Wrapper around CyclicLR learning rate scheduler
|
||||
|
||||
Parameters
|
||||
----------
|
||||
optimizer : Optimizer
|
||||
Optimizer
|
||||
min_lr : float, optional
|
||||
Defaults to 1e-8.
|
||||
max_lr : float, optional
|
||||
Defaults to 1e-3
|
||||
patience : int, optional
|
||||
Number of epochs per cycle. Defaults to 50.
|
||||
num_batches_per_epoch : int, optional
|
||||
Number of batches per epoch.
|
||||
mode : {"triangular", "triangular2"}, optional
|
||||
Defaults to "triangular2".
|
||||
"""
|
||||
|
||||
step_size_up = int(0.5 * patience * num_batches_per_epoch)
|
||||
|
||||
return {
|
||||
"scheduler": _CyclicLR(
|
||||
optimizer,
|
||||
base_lr=min_lr,
|
||||
max_lr=max_lr,
|
||||
step_size_up=step_size_up,
|
||||
mode=mode,
|
||||
cycle_momentum=False,
|
||||
),
|
||||
"interval": "step",
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
from typing import Optional, Text
|
||||
|
||||
from torch.optim import Optimizer
|
||||
from torch.optim.lr_scheduler import ReduceLROnPlateau as _ReduceLROnPlateau
|
||||
|
||||
|
||||
def ReduceLROnPlateau(
|
||||
optimizer: Optimizer,
|
||||
monitor: Optional[Text] = None,
|
||||
direction: Optional[Text] = "min",
|
||||
min_lr: float = 1e-8,
|
||||
max_lr: float = 1e-3,
|
||||
factor: float = 0.5,
|
||||
patience: int = 50,
|
||||
**kwargs,
|
||||
):
|
||||
"""Wrapper around ReduceLROnPlateau learning rate scheduler
|
||||
|
||||
Parameters
|
||||
----------
|
||||
optimizer : Optimizer
|
||||
Optimizer
|
||||
min_lr : float, optional
|
||||
Defaults to 1e-8.
|
||||
max_lr : float, optional
|
||||
Defaults to 1e-3
|
||||
factor : float, optional
|
||||
Defaults to 0.5
|
||||
patience : int, optional
|
||||
Wait that many epochs with no improvement before reducing the learning rate.
|
||||
Defaults to 50.
|
||||
monitor : str, optional
|
||||
Value to monitor
|
||||
direction : {"min", "max"}, optional
|
||||
"min" (resp. "max") means smaller (resp. larger) is better.
|
||||
"""
|
||||
|
||||
# initialize optimizer lr to max_lr
|
||||
for g in optimizer.param_groups:
|
||||
g["lr"] = max_lr
|
||||
|
||||
return {
|
||||
"scheduler": _ReduceLROnPlateau(
|
||||
optimizer,
|
||||
mode=direction,
|
||||
factor=factor,
|
||||
patience=patience,
|
||||
threshold=0.0001,
|
||||
threshold_mode="rel",
|
||||
cooldown=0,
|
||||
min_lr=min_lr,
|
||||
eps=1e-08,
|
||||
verbose=False,
|
||||
),
|
||||
"interval": "epoch",
|
||||
"monitor": monitor,
|
||||
"strict": True,
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
from .CosineAnnealingWarmRestarts import CosineAnnealingWarmRestarts
|
||||
from .CyclicLR import CyclicLR
|
||||
from .ReduceLROnPlateau import ReduceLROnPlateau
|
||||
|
||||
__all__ = ["ReduceLROnPlateau", "CyclicLR", "CosineAnnealingWarmRestarts"]
|
||||
@@ -1,29 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020-2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
from typing import Text
|
||||
from pyannote.audio import Model
|
||||
|
||||
|
||||
def pretrained(checkpoint: Text):
|
||||
return Model.from_pretrained(checkpoint, map_location=lambda storage, loc: storage)
|
||||
@@ -1,171 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020-2022 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import os
|
||||
from types import MethodType
|
||||
from typing import Optional
|
||||
|
||||
import hydra
|
||||
from hydra.utils import instantiate
|
||||
from lightning.pytorch import seed_everything
|
||||
from omegaconf import DictConfig, OmegaConf
|
||||
|
||||
# from pyannote.audio.core.callback import GraduallyUnfreeze
|
||||
from pyannote.database import FileFinder, registry
|
||||
from pytorch_lightning.callbacks import (
|
||||
EarlyStopping,
|
||||
LearningRateMonitor,
|
||||
ModelCheckpoint,
|
||||
RichProgressBar,
|
||||
)
|
||||
from pytorch_lightning.loggers import TensorBoardLogger
|
||||
from torch_audiomentations.utils.config import from_dict as get_augmentation
|
||||
|
||||
from pyannote.audio.core.io import get_torchaudio_info
|
||||
|
||||
|
||||
@hydra.main(config_path="train_config", config_name="config")
|
||||
def train(cfg: DictConfig) -> Optional[float]:
|
||||
# make sure to set the random seed before the instantiation of Trainer
|
||||
# so that each model initializes with the same weights when using DDP.
|
||||
seed = int(os.environ.get("PL_GLOBAL_SEED", "0"))
|
||||
seed_everything(seed=seed)
|
||||
|
||||
# load databases into registry
|
||||
if "registry" in cfg:
|
||||
for database_yml in cfg.registry.split(","):
|
||||
registry.load_database(database_yml)
|
||||
|
||||
# instantiate training protocol with optional preprocessors
|
||||
preprocessors = {"audio": FileFinder(), "torchaudio.info": get_torchaudio_info}
|
||||
if "preprocessor" in cfg:
|
||||
preprocessor = instantiate(cfg.preprocessor)
|
||||
preprocessors[preprocessor.preprocessed_key] = preprocessor
|
||||
protocol = registry.get_protocol(cfg.protocol, preprocessors=preprocessors)
|
||||
|
||||
# instantiate data augmentation
|
||||
augmentation = (
|
||||
get_augmentation(OmegaConf.to_container(cfg.augmentation))
|
||||
if "augmentation" in cfg
|
||||
else None
|
||||
)
|
||||
if augmentation is not None:
|
||||
augmentation.output_type = "dict"
|
||||
|
||||
# instantiate task and validation metric
|
||||
task = instantiate(cfg.task, protocol, augmentation=augmentation)
|
||||
|
||||
# instantiate model
|
||||
fine_tuning = cfg.model["_target_"] == "pyannote.audio.cli.pretrained"
|
||||
model = instantiate(cfg.model, task=task)
|
||||
model.prepare_data()
|
||||
model.setup()
|
||||
|
||||
# validation metric to monitor (and its direction: min or max)
|
||||
monitor, direction = task.val_monitor
|
||||
|
||||
# number of batches in one epoch
|
||||
num_batches_per_epoch = model.task.train__len__() // model.task.batch_size
|
||||
|
||||
# configure optimizer and scheduler
|
||||
def configure_optimizers(self):
|
||||
optimizer = instantiate(cfg.optimizer, self.parameters())
|
||||
lr_scheduler = instantiate(
|
||||
cfg.scheduler,
|
||||
optimizer,
|
||||
monitor=monitor,
|
||||
direction=direction,
|
||||
num_batches_per_epoch=num_batches_per_epoch,
|
||||
)
|
||||
return {"optimizer": optimizer, "lr_scheduler": lr_scheduler}
|
||||
|
||||
model.configure_optimizers = MethodType(configure_optimizers, model)
|
||||
|
||||
# avoid creating big log files
|
||||
callbacks = [
|
||||
RichProgressBar(refresh_rate=20, leave=True),
|
||||
LearningRateMonitor(),
|
||||
]
|
||||
|
||||
if fine_tuning:
|
||||
# TODO: configure layer freezing
|
||||
# TODO: for fine-tuning and/or transfer learning, we start by fitting
|
||||
# TODO: task-dependent layers and gradully unfreeze more layers
|
||||
# TODO: callbacks.append(GraduallyUnfreeze(epochs_per_stage=1))
|
||||
pass
|
||||
|
||||
checkpoint = ModelCheckpoint(
|
||||
monitor=monitor,
|
||||
mode=direction,
|
||||
save_top_k=None if monitor is None else 10,
|
||||
every_n_epochs=1,
|
||||
save_last=True,
|
||||
save_weights_only=False,
|
||||
dirpath=".",
|
||||
filename="{epoch}" if monitor is None else f"{{epoch}}-{{{monitor}:.6f}}",
|
||||
verbose=False,
|
||||
)
|
||||
callbacks.append(checkpoint)
|
||||
|
||||
if monitor is not None:
|
||||
early_stopping = EarlyStopping(
|
||||
monitor=monitor,
|
||||
mode=direction,
|
||||
min_delta=0.0,
|
||||
patience=100,
|
||||
strict=True,
|
||||
verbose=False,
|
||||
check_finite=True,
|
||||
)
|
||||
callbacks.append(early_stopping)
|
||||
|
||||
# instantiate logger
|
||||
logger = TensorBoardLogger(".", name="", version="", log_graph=False)
|
||||
|
||||
# instantiate trainer
|
||||
trainer = instantiate(cfg.trainer, callbacks=callbacks, logger=logger)
|
||||
|
||||
# in case of fine-tuning, validate the initial model to make sure
|
||||
# that we actually improve over the initial performance
|
||||
if fine_tuning:
|
||||
trainer.validate(model)
|
||||
|
||||
# train the model
|
||||
trainer.fit(model)
|
||||
|
||||
# save paths to best models
|
||||
checkpoint.to_yaml()
|
||||
|
||||
# return the best validation score
|
||||
# this can be used for hyper-parameter optimization with Hydra sweepers
|
||||
# this can only be done if the trainer is not in fast dev run mode, as
|
||||
# checkpointing is disabled in this mode
|
||||
if monitor is not None and not trainer.fast_dev_run:
|
||||
best_monitor = float(checkpoint.best_model_score)
|
||||
if direction == "min":
|
||||
return best_monitor
|
||||
else:
|
||||
return -best_monitor
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
train()
|
||||
@@ -1,21 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020-2021 CNRS
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
@@ -1,9 +0,0 @@
|
||||
protocol: ???
|
||||
|
||||
defaults:
|
||||
- task: SpeakerDiarization
|
||||
- model: PyanNet
|
||||
- optimizer: Adam
|
||||
- scheduler: CosineAnnealingWarmRestarts
|
||||
- trainer: default
|
||||
- hydra: default
|
||||
@@ -1,31 +0,0 @@
|
||||
# @package _group_
|
||||
|
||||
run:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
|
||||
sweep:
|
||||
dir: ${protocol}/${now:%Y-%m-%dT%H:%M:%S.%fZ}
|
||||
subdir: ${hydra.job.num}
|
||||
|
||||
output_subdir: ""
|
||||
|
||||
help:
|
||||
app_name: pyannote-audio-train
|
||||
|
||||
# Help header, customize to describe your app to your users
|
||||
header: == ${hydra.help.app_name} ==
|
||||
|
||||
footer: |-
|
||||
Powered by Hydra (https://hydra.cc)
|
||||
Use --hydra-help to view Hydra specific help
|
||||
|
||||
template: |-
|
||||
${hydra.help.header}
|
||||
|
||||
pyannote-audio-train protocol={protocol_name}
|
||||
+task={task} task.param=...
|
||||
+model={model} model.param=...
|
||||
optimizer={optimizer} optimizer.param=...
|
||||
scheduler={scheduler} scheduler.param=...
|
||||
|
||||
${hydra.help.footer}
|
||||
@@ -1,2 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.embedding.debug.SimpleEmbeddingModel
|
||||
@@ -1,2 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.segmentation.debug.SimpleSegmentationModel
|
||||
@@ -1,3 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.cli.pretrained
|
||||
checkpoint: ???
|
||||
@@ -1,13 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.segmentation.PyanNet
|
||||
sincnet:
|
||||
stride: 10
|
||||
lstm:
|
||||
hidden_size: 128
|
||||
num_layers: 2
|
||||
bidirectional: true
|
||||
monolithic: true
|
||||
dropout: 0.5
|
||||
linear:
|
||||
hidden_size: 128
|
||||
num_layers: 2
|
||||
@@ -1,13 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.segmentation.SSeRiouSS
|
||||
wav2vec: WAVLM_BASE
|
||||
wav2vec_layer: -1
|
||||
lstm:
|
||||
hidden_size: 128
|
||||
num_layers: 4
|
||||
bidirectional: true
|
||||
monolithic: true
|
||||
dropout: 0.5
|
||||
linear:
|
||||
hidden_size: 128
|
||||
num_layers: 2
|
||||
@@ -1,2 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.embedding.XVectorMFCC
|
||||
@@ -1,2 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.models.embedding.XVectorSincNet
|
||||
@@ -1,7 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: torch.optim.Adam
|
||||
lr: 1e-3
|
||||
betas: [0.9, 0.999]
|
||||
eps: 1e-08
|
||||
weight_decay: 0
|
||||
amsgrad: False
|
||||
@@ -1,7 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: torch.optim.AdamW
|
||||
lr: 1e-3
|
||||
betas: [0.9, 0.999]
|
||||
eps: 1e-08
|
||||
weight_decay: 0.01
|
||||
amsgrad: False
|
||||
@@ -1,5 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: adan_pytorch.Adan
|
||||
lr: 1e-3
|
||||
betas: [0.1, 0.1, 0.001]
|
||||
weight_decay: 0.0
|
||||
@@ -1,3 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.utils.preprocessors.LowerTemporalResolution
|
||||
resolution: 0.1
|
||||
@@ -1,5 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.cli.lr_schedulers.CosineAnnealingWarmRestarts
|
||||
min_lr: 1e-8
|
||||
max_lr: 1e-3
|
||||
patience: 1
|
||||
@@ -1,6 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.cli.lr_schedulers.CyclicLR
|
||||
min_lr: 1e-8
|
||||
max_lr: 1e-3
|
||||
mode: triangular2
|
||||
patience: 50
|
||||
@@ -1,6 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.cli.lr_schedulers.ReduceLROnPlateau
|
||||
min_lr: 1e-8
|
||||
max_lr: 1e-3
|
||||
factor: 0.5
|
||||
patience: 50
|
||||
@@ -1,9 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.tasks.MultiLabelSegmentation
|
||||
duration: 3.0
|
||||
warm_up: 0.0
|
||||
balance: null
|
||||
weight: null
|
||||
batch_size: 32
|
||||
num_workers: null
|
||||
pin_memory: False
|
||||
@@ -1,13 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.tasks.OverlappedSpeechDetection
|
||||
duration: 3.0
|
||||
warm_up: 0.0
|
||||
balance: null
|
||||
overlap:
|
||||
probability: 0.5
|
||||
snr_min: 0.0
|
||||
snr_max: 10.0
|
||||
weight: null
|
||||
batch_size: 32
|
||||
num_workers: null
|
||||
pin_memory: False
|
||||
@@ -1,8 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.tasks.SpeakerDiarization
|
||||
duration: 5.0
|
||||
max_speakers_per_chunk: 3
|
||||
max_speakers_per_frame: 2
|
||||
batch_size: 32
|
||||
num_workers: 10
|
||||
pin_memory: False
|
||||
@@ -1,10 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.tasks.SupervisedRepresentationLearningWithArcFace
|
||||
min_duration: 2.0
|
||||
duration: 5.0
|
||||
num_classes_per_batch: 512
|
||||
num_chunks_per_class: 1
|
||||
margin: 2.0
|
||||
scale: 12.0
|
||||
num_workers: null
|
||||
pin_memory: False
|
||||
@@ -1,9 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pyannote.audio.tasks.VoiceActivityDetection
|
||||
duration: 3.0
|
||||
warm_up: 0.0
|
||||
balance: null
|
||||
weight: null
|
||||
batch_size: 32
|
||||
num_workers: null
|
||||
pin_memory: False
|
||||
@@ -1,35 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pytorch_lightning.Trainer
|
||||
accelerator: auto
|
||||
accumulate_grad_batches: 1
|
||||
benchmark: null # TODO: automatically set to True when using fixed duration chunks
|
||||
deterministic: False
|
||||
check_val_every_n_epoch: 1
|
||||
devices: auto
|
||||
detect_anomaly: False
|
||||
enable_checkpointing: True
|
||||
enable_model_summary: True
|
||||
enable_progress_bar: True
|
||||
fast_dev_run: False
|
||||
gradient_clip_val: null
|
||||
gradient_clip_algorithm: norm
|
||||
limit_predict_batches: 1.0
|
||||
limit_test_batches: 1.0
|
||||
limit_train_batches: 1.0
|
||||
limit_val_batches: 1.0
|
||||
log_every_n_steps: 50
|
||||
max_epochs: 1000
|
||||
max_steps: -1
|
||||
max_time: null
|
||||
min_epochs: 1
|
||||
min_steps: null
|
||||
num_nodes: 1
|
||||
num_sanity_val_steps: 2
|
||||
overfit_batches: 0.0
|
||||
precision: 32
|
||||
profiler: null
|
||||
reload_dataloaders_every_n_epochs: 0
|
||||
use_distributed_sampler: True # TODO: check what this does exactly
|
||||
strategy: auto
|
||||
sync_batchnorm: False
|
||||
val_check_interval: 1.0
|
||||
@@ -1,3 +0,0 @@
|
||||
# @package _group_
|
||||
_target_: pytorch_lightning.Trainer
|
||||
fast_dev_run: True
|
||||
@@ -0,0 +1,72 @@
|
||||
[project]
|
||||
name = "pyannote-audio"
|
||||
description = "State-of-the-art speaker diarization toolkit"
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
{ name = "Hervé BREDIN", email = "herve@pyannote.ai" }
|
||||
]
|
||||
requires-python = ">=3.10"
|
||||
|
||||
dynamic = [
|
||||
"version",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
"asteroid-filterbanks>=0.4.0",
|
||||
"einops>=0.8.1",
|
||||
"huggingface-hub>=0.28.1",
|
||||
"lightning>=2.5.0.post0",
|
||||
"pyannote-core>=6.0.0rc1",
|
||||
"pyannote-database>=6.0.0rc1",
|
||||
"pyannote-metrics>=4.0.0rc1",
|
||||
"pyannote-pipeline>=4.0.0rc1",
|
||||
"pytorch-metric-learning>=2.8.1",
|
||||
"rich>=13.9.4",
|
||||
"safetensors>=0.5.2",
|
||||
"torch-audiomentations>=0.12.0",
|
||||
"torch>=2.6.0",
|
||||
"torchaudio>=2.6.0",
|
||||
"torchmetrics>=1.6.1",
|
||||
"soundfile>=0.13.1",
|
||||
"matplotlib>=3.10.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
pyannote-audio = "pyannote.audio.__main__:app"
|
||||
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = [
|
||||
"papermill>=2.6.0",
|
||||
"pytest>=8.3.4",
|
||||
"speechbrain>=1.0.2",
|
||||
]
|
||||
doc = [
|
||||
"sphinx-rtd-theme>=3.0.2",
|
||||
"sphinx>=8.1.3",
|
||||
]
|
||||
cli = [
|
||||
"typer>=0.15.1",
|
||||
]
|
||||
separation = [
|
||||
"asteroid>=0.5.2",
|
||||
"transformers>=4.48.3",
|
||||
]
|
||||
dev = [
|
||||
"ipython>=8.32.0",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling", "hatch-vcs"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.version]
|
||||
source = "vcs"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/pyannote"]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"ipykernel>=6.29.5",
|
||||
]
|
||||
@@ -1,20 +0,0 @@
|
||||
asteroid-filterbanks >=0.4
|
||||
einops >=0.6.0
|
||||
huggingface_hub >= 0.13.0
|
||||
lightning >= 2.0.1
|
||||
omegaconf >=2.1,<3.0
|
||||
pyannote.core >= 5.0.0
|
||||
pyannote.database >= 5.1.3
|
||||
pyannote.metrics >= 3.2.1
|
||||
pyannote.pipeline >= 3.0.1
|
||||
pytorch_metric_learning >= 2.1.0
|
||||
rich >= 12.0.0
|
||||
safetensors >= 0.4.5
|
||||
semver >= 3.0.0
|
||||
soundfile >= 0.12.1
|
||||
speechbrain >= 1.0.0
|
||||
tensorboardX >= 2.6
|
||||
torch >= 2.0.0
|
||||
torch_audiomentations >= 0.12.0
|
||||
torchaudio >= 2.2.0
|
||||
torchmetrics >= 0.11.0
|
||||
@@ -1,119 +0,0 @@
|
||||
# This file is used to configure your project.
|
||||
# Read more about the various options under:
|
||||
# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
|
||||
|
||||
[metadata]
|
||||
name = pyannote-audio
|
||||
description = Neural speaker diarization
|
||||
author = Herve Bredin
|
||||
author-email = herve.bredin@irit.fr
|
||||
license = mit
|
||||
long-description = file: README.md
|
||||
long-description-content-type = text/markdown; charset=UTF-8; variant=GFM
|
||||
# Change if running only on Windows, Mac or Linux (comma-separated)
|
||||
platforms = Linux, Mac
|
||||
# Add here all kinds of additional classifiers as defined under
|
||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
classifiers =
|
||||
Development Status :: 4 - Beta
|
||||
Programming Language :: Python
|
||||
|
||||
[options]
|
||||
zip_safe = False
|
||||
packages = find:
|
||||
include_package_data = True
|
||||
# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD!
|
||||
setup_requires = pyscaffold>=3.2a0,<3.3a0
|
||||
# Add here dependencies of your project (semicolon/line-separated), e.g.
|
||||
# install_requires = numpy; scipy
|
||||
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
|
||||
python_requires = >=3.9
|
||||
|
||||
[options.packages.find]
|
||||
where = .
|
||||
exclude =
|
||||
tests
|
||||
|
||||
[options.extras_require]
|
||||
# Add here additional requirements for extra features, to install with:
|
||||
# `pip install fastaudio[PDF]` like:
|
||||
# PDF = ReportLab; RXP
|
||||
# Add here test requirements (semicolon/line-separated)
|
||||
testing =
|
||||
pytest>=6.0
|
||||
pytest-cov>=2.10
|
||||
jupyter
|
||||
papermill
|
||||
dev =
|
||||
pre_commit>=2.7
|
||||
recommonmark>=0.6
|
||||
black>=22.3.0
|
||||
cli =
|
||||
hydra-core >=1.1,<1.2
|
||||
typer >= 0.12.0
|
||||
separation =
|
||||
transformers >= 4.39.1
|
||||
asteroid >=0.7.0
|
||||
|
||||
[options.entry_points]
|
||||
|
||||
console_scripts =
|
||||
pyannote-audio-train=pyannote.audio.cli.train:train
|
||||
pyannote-audio-eval=pyannote.audio.cli.evaluate:evaluate
|
||||
|
||||
|
||||
[test]
|
||||
# py.test options when running `python setup.py test`
|
||||
# addopts = --verbose
|
||||
extras = True
|
||||
|
||||
[tool:pytest]
|
||||
# Options for py.test:
|
||||
# Specify command line options as you would do when invoking py.test directly.
|
||||
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
|
||||
# in order to write a coverage file that can be read by Jenkins.
|
||||
addopts =
|
||||
--cov pyannote --cov-report term-missing
|
||||
--verbose
|
||||
norecursedirs =
|
||||
dist
|
||||
build
|
||||
.tox
|
||||
testpaths = tests
|
||||
|
||||
[aliases]
|
||||
dists = bdist_wheel
|
||||
|
||||
[bdist_wheel]
|
||||
# Use this option if your package is pure-python
|
||||
universal = 1
|
||||
|
||||
[build_sphinx]
|
||||
source_dir = doc
|
||||
build_dir = build/sphinx
|
||||
|
||||
[devpi:upload]
|
||||
# Options for the devpi: PyPI server and packaging tool
|
||||
# VCS export must be deactivated since we are using setuptools-scm
|
||||
no-vcs = 1
|
||||
formats = bdist_wheel
|
||||
|
||||
[flake8]
|
||||
# Some sane defaults for the code style checker flake8
|
||||
exclude =
|
||||
.tox
|
||||
build
|
||||
dist
|
||||
.eggs
|
||||
docs/conf.py
|
||||
|
||||
[pyscaffold]
|
||||
# PyScaffold's parameters when the project was created.
|
||||
# This will be used when updating. Do not change!
|
||||
version = 3.2.3
|
||||
package = pyannote-audio
|
||||
extensions =
|
||||
markdown
|
||||
no_skeleton
|
||||
pre_commit
|
||||
dsproject
|
||||
@@ -20,11 +20,10 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
try:
|
||||
from .version import __version__, git_version # noqa: F401
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
import importlib.metadata
|
||||
|
||||
__version__ = importlib.metadata.version("pyannote-audio")
|
||||
|
||||
from .core.inference import Inference
|
||||
from .core.io import Audio
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -22,8 +22,8 @@
|
||||
|
||||
from typing import List, Mapping, Optional, Text, Union
|
||||
|
||||
from pytorch_lightning import Callback, Trainer
|
||||
from pytorch_lightning.utilities.model_summary import ModelSummary
|
||||
from lightning.pytorch import Callback, Trainer
|
||||
from lightning.pytorch.utilities.model_summary import ModelSummary
|
||||
|
||||
from pyannote.audio import Model
|
||||
|
||||
@@ -80,7 +80,6 @@ class GraduallyUnfreeze(Callback):
|
||||
self.schedule = schedule
|
||||
|
||||
def on_fit_start(self, trainer: Trainer, model: Model):
|
||||
|
||||
schedule = self.schedule
|
||||
|
||||
task_specific_layers = model.task_dependent
|
||||
@@ -28,8 +28,8 @@ import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
from einops import rearrange
|
||||
from lightning.pytorch.utilities.memory import is_oom_error
|
||||
from pyannote.core import Segment, SlidingWindow, SlidingWindowFeature
|
||||
from pytorch_lightning.utilities.memory import is_oom_error
|
||||
|
||||
from pyannote.audio.core.io import AudioFile
|
||||
from pyannote.audio.core.model import Model, Specifications
|
||||
@@ -34,7 +34,6 @@ from io import IOBase
|
||||
from pathlib import Path
|
||||
from typing import Mapping, Optional, Text, Tuple, Union
|
||||
|
||||
import numpy as np
|
||||
import torch.nn.functional as F
|
||||
import torchaudio
|
||||
from pyannote.core import Segment
|
||||
@@ -30,13 +30,13 @@ from importlib import import_module
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Text, Tuple, Union
|
||||
|
||||
import pytorch_lightning as pl
|
||||
import lightning.pytorch as pl
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.optim
|
||||
from lightning_fabric.utilities.cloud_io import _load as pl_load
|
||||
from lightning.fabric.utilities.cloud_io import _load as pl_load
|
||||
from lightning.pytorch.utilities.model_summary.model_summary import ModelSummary
|
||||
from pyannote.core import SlidingWindow
|
||||
from pytorch_lightning.utilities.model_summary.model_summary import ModelSummary
|
||||
from torch.utils.data import DataLoader
|
||||
|
||||
from pyannote.audio import __version__
|
||||
File renamed without changes.
@@ -36,8 +36,8 @@ from pathlib import Path
|
||||
from tempfile import mkstemp
|
||||
from typing import Dict, List, Literal, Optional, Sequence, Text, Tuple, Union
|
||||
|
||||
import lightning.pytorch as pl
|
||||
import numpy as np
|
||||
import pytorch_lightning as pl
|
||||
import scipy.special
|
||||
import torch
|
||||
from pyannote.database import Protocol
|
||||
@@ -872,8 +872,8 @@ class Task(pl.LightningDataModule):
|
||||
|
||||
See also
|
||||
--------
|
||||
pytorch_lightning.callbacks.ModelCheckpoint
|
||||
pytorch_lightning.callbacks.EarlyStopping
|
||||
lightning.pytorch.callbacks.ModelCheckpoint
|
||||
lightning.pytorch.callbacks.EarlyStopping
|
||||
"""
|
||||
|
||||
name, metric = next(iter(self.metric.items()))
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -25,7 +25,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytorch_lightning as pl
|
||||
import lightning.pytorch as pl
|
||||
import torch
|
||||
|
||||
import pyannote.audio.models.embedding.wespeaker as wespeaker
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
-1
@@ -20,7 +20,6 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import contextlib
|
||||
from functools import lru_cache
|
||||
from typing import Optional, Union
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -656,8 +656,8 @@ class SpeechSeparation(SpeakerDiarizationMixin, Pipeline):
|
||||
|
||||
# separated sources might be scaled up/down due to SI-SDR loss used when training
|
||||
# so we peak-normalize them
|
||||
sources.data = (
|
||||
sources.data / (np.max(np.abs(sources.data), axis=0, keepdims=True) + 1e-8)
|
||||
sources.data = sources.data / (
|
||||
np.max(np.abs(sources.data), axis=0, keepdims=True) + 1e-8
|
||||
)
|
||||
|
||||
# convert to continuous diarization
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user