Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ repos:
entry: bash .pre-commit-hooks/clang-format.hook -i
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
exclude: (?=speechx/speechx/kaldi|speechx/patch).*(\.cpp|\.cc|\.h|\.py)$
exclude: (?=speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
- id: copyright_checker
name: copyright_checker
entry: python .pre-commit-hooks/copyright-check.hook
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
exclude: (?=third_party|pypinyin|speechx/speechx/kaldi|speechx/patch).*(\.cpp|\.cc|\.h|\.py)$
exclude: (?=third_party|pypinyin|speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
hooks:
Expand Down
3 changes: 1 addition & 2 deletions demos/audio_searching/src/audio_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from fastapi import FastAPI
from fastapi import File
from fastapi import UploadFile
from logs import LOGGER
from milvus_helpers import MilvusHelper
from mysql_helpers import MySQLHelper
from operations.count import do_count
Expand All @@ -31,8 +32,6 @@
from starlette.requests import Request
from starlette.responses import FileResponse

from logs import LOGGER

app = FastAPI()
app.add_middleware(
CORSMiddleware,
Expand Down
2 changes: 1 addition & 1 deletion demos/audio_searching/src/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np

from logs import LOGGER

from paddlespeech.cli import VectorExecutor

vector_executor = VectorExecutor()
Expand Down
1 change: 0 additions & 1 deletion demos/audio_searching/src/mysql_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from config import MYSQL_PORT
from config import MYSQL_PWD
from config import MYSQL_USER

from logs import LOGGER


Expand Down
1 change: 0 additions & 1 deletion demos/audio_searching/src/operations/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import sys

from config import DEFAULT_TABLE

from logs import LOGGER


Expand Down
1 change: 0 additions & 1 deletion demos/audio_searching/src/operations/drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import sys

from config import DEFAULT_TABLE

from logs import LOGGER


Expand Down
6 changes: 2 additions & 4 deletions demos/audio_searching/src/operations/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from config import DEFAULT_TABLE
from diskcache import Cache
from encode import get_audio_embedding

from logs import LOGGER


Expand All @@ -27,9 +26,8 @@ def get_audios(path):
"""
supported_formats = [".wav", ".mp3", ".ogg", ".flac", ".m4a"]
return [
item
for sublist in [[os.path.join(dir, file) for file in files]
for dir, _, files in list(os.walk(path))]
item for sublist in [[os.path.join(dir, file) for file in files]
for dir, _, files in list(os.walk(path))]
for item in sublist if os.path.splitext(item)[1] in supported_formats
]

Expand Down
1 change: 0 additions & 1 deletion demos/audio_searching/src/operations/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from config import DEFAULT_TABLE
from config import TOP_K
from encode import get_audio_embedding

from logs import LOGGER


Expand Down
3 changes: 1 addition & 2 deletions demos/audio_searching/src/vpr_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from fastapi import FastAPI
from fastapi import File
from fastapi import UploadFile
from logs import LOGGER
from mysql_helpers import MySQLHelper
from operations.count import do_count_vpr
from operations.count import do_get
Expand All @@ -30,8 +31,6 @@
from starlette.requests import Request
from starlette.responses import FileResponse

from logs import LOGGER

app = FastAPI()
app.add_middleware(
CORSMiddleware,
Expand Down
2 changes: 1 addition & 1 deletion paddleaudio/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def remove_version_py(filename='paddleaudio/__init__.py'):
install_requires=[
'numpy >= 1.15.0', 'scipy >= 1.0.0', 'resampy >= 0.2.2',
'soundfile >= 0.9.0', 'colorlog', 'dtaidistance == 2.3.1', 'pathos'
],
],
extras_require={
'test': [
'nose', 'librosa==0.8.1', 'soundfile==0.10.3.post1',
Expand Down
9 changes: 5 additions & 4 deletions paddlespeech/server/bin/paddlespeech_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import asyncio
import base64
import io
import json
import logging
import os
import random
import time
from typing import List
import logging
import asyncio

import numpy as np
import requests
Expand All @@ -30,9 +30,9 @@
from ..util import cli_client_register
from ..util import stats_wrapper
from paddlespeech.cli.log import logger
from paddlespeech.server.tests.asr.online.websocket_client import ASRAudioHandler
from paddlespeech.server.utils.audio_process import wav2pcm
from paddlespeech.server.utils.util import wav2base64
from paddlespeech.server.tests.asr.online.websocket_client import ASRAudioHandler

__all__ = ['TTSClientExecutor', 'ASRClientExecutor', 'CLSClientExecutor']

Expand Down Expand Up @@ -234,7 +234,8 @@ def __call__(self,


@cli_client_register(
name='paddlespeech_client.asr_online', description='visit asr online service')
name='paddlespeech_client.asr_online',
description='visit asr online service')
class ASRClientExecutor(BaseExecutor):
def __init__(self):
super(ASRClientExecutor, self).__init__()
Expand Down
7 changes: 4 additions & 3 deletions paddlespeech/server/tests/asr/online/web/app.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2021 Mobvoi Inc. All Rights Reserved.
# Author: [email protected] (Zhendong Peng)

import argparse

from flask import Flask, render_template
from flask import Flask
from flask import render_template

parser = argparse.ArgumentParser(description='training your network')
parser.add_argument('--port', default=19999, type=int, help='port id')
args = parser.parse_args()

app = Flask(__name__)


@app.route('/')
def index():
return render_template('index.html')


if __name__ == '__main__':
app.run(host='0.0.0.0', port=args.port, debug=True)
2 changes: 1 addition & 1 deletion paddlespeech/server/tests/asr/online/web/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
在浏览器中输入127.0.0.1:19999 即可看到相关网页Demo。

![图片](./paddle_web_demo.png)


1 change: 1 addition & 0 deletions paddlespeech/vector/io/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
from dataclasses import dataclass
from dataclasses import fields

from paddle.io import Dataset

from paddleaudio import load as load_audio
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/vector/io/dataset_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json

from dataclasses import dataclass
from dataclasses import fields

from paddle.io import Dataset

from paddleaudio import load as load_audio
Expand Down
7 changes: 2 additions & 5 deletions speechx/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

add_subdirectory(feat)
add_subdirectory(nnet)
add_subdirectory(decoder)

add_subdirectory(glog)
add_subdirectory(ds2_ol)
add_subdirectory(dev)
22 changes: 15 additions & 7 deletions speechx/examples/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Examples
# Examples for SpeechX

* dev - for speechx developer, using for test.
* ngram - using to build NGram ARPA lm.
* ds2_ol - ds2 streaming test under `aishell-1` test dataset.
The entrypoint is `ds2_ol/aishell/run.sh`

* glog - glog usage
* feat - mfcc, linear
* nnet - ds2 nn
* decoder - online decoder to work as offline

## How to run

`run.sh` is the entry point.

Example to play `decoder`:
Example to play `ds2_ol`:

```
pushd decoder
pushd ds2_ol/aishell
bash run.sh
```

## Display Model with [Netron](https://github.com/lutzroeder/netron)

```
pip install netron
netron exp/deepspeech2_online/checkpoints/avg_1.jit.pdmodel --port 8022 --host 10.21.55.20
```
Loading