Skip to content

Commit

Permalink
Merge branch 'master' into DynamicTrimGap
Browse files Browse the repository at this point in the history
  • Loading branch information
fireblade2534 authored Jan 13, 2025
2 parents daeb98a + 234445f commit 79970fd
Show file tree
Hide file tree
Showing 39 changed files with 1,120 additions and 670 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Version control
.git
.gitignore

# Python
__pycache__
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [ "develop", "master" ]
pull_request:
branches: [ "develop", "master" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false

steps:
- uses: actions/checkout@v4

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

- name: Set up pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install PyTorch CPU
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install dependencies
run: |
pip install ruff pytest-cov
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Lint with ruff
run: |
ruff check .
- name: Test with pytest
run: |
pytest --asyncio-mode=auto --cov=api --cov-report=term-missing
16 changes: 8 additions & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
flavor: |
suffix=-cpu
tags: |
type=semver,pattern=v{{version}}-cpu
type=semver,pattern=v{{major}}.{{minor}}-cpu
type=semver,pattern=v{{major}}-cpu
type=raw,value=latest-cpu
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=raw,value=latest
# Build and push GPU version
- name: Build and push GPU Docker image
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
flavor: |
suffix=-ui
tags: |
type=semver,pattern=v{{version}}-ui
type=semver,pattern=v{{major}}.{{minor}}-ui
type=semver,pattern=v{{major}}-ui
type=raw,value=latest-ui
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=raw,value=latest
# Build and push UI version
- name: Build and push UI Docker image
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/sync-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Sync develop with master

on:
push:
branches:
- master

jobs:
sync-develop:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: develop

- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Merge master into develop
run: |
git fetch origin master:master
git merge --no-ff origin/master -m "chore: Merge master into develop branch"
- name: Push changes
run: |
if ! git push origin develop; then
echo "Failed to push to develop branch"
exit 1
fi
- name: Handle Failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const issueBody = `Automatic merge from master to develop failed.
Please resolve this manually
Workflow run: ${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🔄 Automatic master to develop merge failed',
body: issueBody,
labels: ['merge-failed', 'automation']
});
64 changes: 40 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
# Version control
.git

output/*
output_audio/*
ui/data/*

*.db
# Python
__pycache__
*.pyc
*.pth
*.pt

Kokoro-82M/*
__pycache__/
.vscode/
env/
*.pyo
*.pyd
.Python


*.py[cod]
*$py.class
.pytest_cache
.coverage
.coveragerc

examples/assorted_checks/benchmarks/output_audio/*
examples/assorted_checks/test_combinations/output/*
examples/assorted_checks/test_openai/output/*

examples/assorted_checks/test_voices/output/*
examples/assorted_checks/test_formats/output/*
examples/assorted_checks/benchmarks/output_audio_stream/*
ui/RepoScreenshot.png
examples/assorted_checks/benchmarks/output_audio_stream_openai/*

# Environment
# .env
.venv
env/
venv/
ENV/

# IDE
.idea
.vscode
*.swp
*.swo

# Project specific
examples/
Kokoro-82M/
ui/
tests/
*.md
*.txt
!requirements.txt

# Docker
Dockerfile*
docker-compose*

*.egg-info
*.pt
*.wav
*.tar*
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Notable changes to this project will be documented in this file.

## [v0.0.5] - 2025-01-10
### Fixed
- Stabilized issues with images tagging and structures from v0.0.4
- Added automatic master to develop branch synchronization
- Improved release tagging and structures
- Initial CI/CD setup

## 2025-01-04
### Added
- ONNX Support:
Expand Down
1 change: 1 addition & 0 deletions api/src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Settings(BaseSettings):
voices_dir: str = "voices"
sample_rate: int = 24000
max_chunk_size: int = 300 # Maximum size of text chunks for processing

gap_trim_ms: int = 25 # Amount to trim from streaming chunk ends in milliseconds
dynamic_gap_trim_padding_ms: int = 410 # Padding to add to dynamic gap trim
dynamic_gap_trim_padding_char_multiplier: dict[str,float] = {".":1,"!":0.9,"?":1,",":0.8}
Expand Down
16 changes: 6 additions & 10 deletions api/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
FastAPI OpenAI Compatible API
"""

from contextlib import asynccontextmanager
import sys
from contextlib import asynccontextmanager

import uvicorn
from loguru import logger
Expand All @@ -12,9 +12,9 @@

from .core.config import settings
from .services.tts_model import TTSModel
from .routers.development import router as dev_router
from .services.tts_service import TTSService
from .routers.openai_compatible import router as openai_router
from .routers.development import router as dev_router


def setup_logger():
Expand All @@ -24,25 +24,21 @@ def setup_logger():
{
"sink": sys.stdout,
"format": "<fg #2E8B57>{time:hh:mm:ss A}</fg #2E8B57> | "
"{level: <8} | "
"{message}",
"{level: <8} | "
"{message}",
"colorize": True,
"level": "INFO"
"level": "INFO",
},
],
}
# Remove default logger
logger.remove()
# Add our custom logger
logger.configure(**config)
# Override error colors
logger.level("ERROR", color="<red>")


# Configure logger
setup_logger()


@asynccontextmanager
async def lifespan(app: FastAPI):
"""Lifespan context manager for model initialization"""
Expand All @@ -52,7 +48,7 @@ async def lifespan(app: FastAPI):
voicepack_count = await TTSModel.setup()
# boundary = "█████╗"*9
boundary = "░" * 24
startup_msg =f"""
startup_msg = f"""
{boundary}
Expand Down
Loading

0 comments on commit 79970fd

Please sign in to comment.