Skip to content

Commit

Permalink
Merge pull request #1 from Wordcab/first-release
Browse files Browse the repository at this point in the history
First release 0.1.0
  • Loading branch information
Thomas Chaigneau authored Mar 31, 2023
2 parents adf1de3 + 6f49af8 commit a58fd59
Show file tree
Hide file tree
Showing 22 changed files with 5,563 additions and 182 deletions.
Binary file added .coverage
Binary file not shown.
2 changes: 2 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[darglint]
strictness = long
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
models
models
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ DEBUG=True
BATCH_SIZE=4
MAX_WAIT=0.1
WHISPER_MODEL="large-v2"
EMBEDDING_MODEL="speechbrain/spkrec-ecapa-voxceleb"
EMBEDDINGS_MODEL="speechbrain/spkrec-ecapa-voxceleb"
COMPUTE_TYPE="int8_float16"
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
select = B,B9,C,D,DAR,E,F,N,RST,S,W
ignore = D212,E203,E501,RST201,RST203,RST301,W503,S106
max-line-length = 119
max-complexity = 10
docstring-convention = google
per-file-ignores = tests/*:S101
rst-roles = class,const,func,meth,mod,ref
rst-directives = deprecated
5 changes: 5 additions & 0 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pip==23.0
nox==2022.11.21
nox-poetry==1.0.2
poetry==1.4.1
virtualenv==20.18.0
162 changes: 162 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Quality Checks

on:
pull_request:
branches:
- main

jobs:
quality:
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Upgrade pip in virtual environments
shell: python
run: |
import os
import pip
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Compute pre-commit cache key
if: matrix.session == 'pre-commit'
id: pre-commit-cache
shell: python
run: |
import hashlib
import sys
python = "py{}.{}".format(*sys.version_info[:2])
payload = sys.version.encode() + sys.executable.encode()
digest = hashlib.sha256(payload).hexdigest()
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
print("::set-output name=result::{}".format(result))
- name: Restore pre-commit cache
uses: actions/cache@v3
if: matrix.session == 'pre-commit'
with:
path: ~/.cache/pre-commit
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ steps.pre-commit-cache.outputs.result }}-
- name: Run Nox
run: |
nox --python=${{ matrix.python }}
# tests:
# name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# needs: [quality]
# strategy:
# fail-fast: true
# matrix:
# include:
# - { python: "3.10", os: "ubuntu-latest", session: "tests" }
# env:
# NOXSESSION: ${{ matrix.session }}
# FORCE_COLOR: "1"
# PRE_COMMIT_COLOR: "always"
# WORDCAB_API_KEY: ${{ secrets.WORDCAB_API_KEY }}

# steps:
# - name: Check out the repository
# uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}

# - name: Upgrade pip
# run: |
# pip install --constraint=.github/workflows/constraints.txt pip
# pip --version
# - name: Upgrade pip in virtual environments
# shell: python
# run: |
# import os
# import pip
# with open(os.environ["GITHUB_ENV"], mode="a") as io:
# print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
# - name: Install Poetry
# run: |
# pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
# poetry --version
# - name: Install Nox
# run: |
# pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
# pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
# nox --version
# - name: Run Nox
# run: |
# nox --python=${{ matrix.python }}
# - name: Upload coverage data
# if: always() && matrix.session == 'tests'
# uses: "actions/upload-artifact@v3"
# with:
# name: coverage-data
# path: ".coverage.*"

# coverage:
# runs-on: ubuntu-latest
# needs: tests
# steps:
# - name: Check out the repository
# uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"

# - name: Upgrade pip
# run: |
# pip install --constraint=.github/workflows/constraints.txt pip
# pip --version
# - name: Install Poetry
# run: |
# pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
# poetry --version
# - name: Install Nox
# run: |
# pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
# pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
# nox --version
# - name: Download coverage data
# uses: actions/download-artifact@v3
# with:
# name: coverage-data

# - name: Combine coverage data and display human readable report
# run: |
# nox --session=coverage
# - name: Create coverage report
# run: |
# nox --session=coverage -- xml
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
__pycache__
__pycache__/
*.mp3
*.wav
.mypy_cache/
/.coverage
/.coverage.*
/.nox/
/.python-version
/.pytype/
/dist/
/docs/_build/
/src/*.egg-info/
.DS_Store
test.ipynb
test.py
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [python]
require_serial: true
- id: check-added-large-files
name: Check for added large files
entry: check-added-large-files
language: system
- id: check-toml
name: Check Toml
entry: check-toml
language: system
types: [toml]
- id: check-yaml
name: Check Yaml
entry: check-yaml
language: system
types: [yaml]
- id: darglint
name: darglint
entry: darglint
language: system
types: [python]
stages: [manual]
- id: end-of-file-fixer
name: Fix End of Files
entry: end-of-file-fixer
language: system
types: [text]
stages: [commit, push, manual]
- id: flake8
name: flake8
entry: flake8
language: system
types: [python]
require_serial: true
args: [--darglint-ignore-regex, .*]
- id: isort
name: isort
entry: isort
require_serial: true
language: system
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
language: system
types: [python]
args: [--py37-plus]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.0
hooks:
- id: prettier
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM nvidia/cuda:11.7.0-devel-ubuntu22.04

COPY requirements.txt /requirements.txt
RUN apt-get update && apt-get install -y \
git \
curl \
Expand All @@ -13,8 +14,6 @@ RUN add-apt-repository ppa:deadsnakes/ppa \
RUN python3.10 -m pip install -r requirements.txt
RUN python3.10 -m pip install --upgrade torch==1.13.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

COPY requirements.txt /requirements.txt

COPY . /app
WORKDIR /app

Expand Down
Loading

0 comments on commit a58fd59

Please sign in to comment.