Skip to content

Instantly share code, notes, and snippets.

View TeaPoly's full-sized avatar

Lucky Wong TeaPoly

View GitHub Profile
#!/bin/bash
# Copyright 2012 Johns Hopkins University (Author: Daniel Povey);
# Arnab Ghoshal, Karel Vesely
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@TeaPoly
TeaPoly / reduced_embedding_decoder.py
Last active July 15, 2022 15:45
Reduced Embedding Decoders, ref: Tied & Reduced RNN-T Decoder
#!/usr/bin/env python3
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@TeaPoly
TeaPoly / gcc_phat_align.py
Last active March 3, 2022 13:15
The GCC-PHAT algorithm is applied to align the far end and near end signals based on Pytorch.
#!/usr/bin/env python3
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@TeaPoly
TeaPoly / multi_channel_attention.py
Last active September 14, 2022 07:12
The implementation of self-attention which is helpful to improve multi-channel KWS performance as well as reduce computational complexity. Inspired from paper Joint Ego-Noise Suppression and Keyword Spotting on Sweeping Robots.
#!/usr/bin/env python3
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@TeaPoly
TeaPoly / mwer_loss.py
Last active November 7, 2022 06:07
The implementation of Minimum Word Error Rate Training loss (MWER) based on negative sampling strategy from <Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition>
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@TeaPoly
TeaPoly / get_wav_duration.py
Last active December 9, 2022 07:36
Fast way to get duration for WAVE PCM format audio.
#!/usr/bin/env python3
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@TeaPoly
TeaPoly / neon_to_rvv.h
Created February 20, 2023 08:25
Neon to RISC-V V
/*
* Copyright (c), Lucky Wong.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#include <riscv_vector.h>
typedef vfloat32m4_t float32x4_t;
@TeaPoly
TeaPoly / lfr.py
Created March 29, 2023 03:11
apply the stacking to inputs
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@TeaPoly
TeaPoly / plot_audio.py
Last active April 25, 2023 08:39
plot audio in SummaryWriter
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2022 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@TeaPoly
TeaPoly / attention_alignment.py
Created May 30, 2023 02:53
Deep model with built-in self-attention alignment for acoustic echo cancellation
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2023 Lucky Wong
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#