Skip to content

Instantly share code, notes, and snippets.

View weimeng23's full-sized avatar
🤩
Focusing

Meng Wei weimeng23

🤩
Focusing
  • Beijing
  • 22:30 (UTC +08:00)
View GitHub Profile
@weimeng23
weimeng23 / CMakeLists.txt
Last active April 16, 2024 16:22
Demo CMakeLists.txt for learning
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# 设置项目名称
project(LearnCmake VERSION 1.0 LANGUAGES CXX)
# 添加可执行文件
add_library(add STATIC add.cc)
add_executable(main main.cc)
@weimeng23
weimeng23 / install_glibc.sh
Last active April 16, 2024 16:11
compile and install glibc in custom path
wget https://github.com/bminor/glibc/archive/refs/tags/glibc-2.35.tar.gz
tar xvf glibc-2.35.tar.gz
cd glibc-glibc-2.35
mkdir build
cd build
../configure --prefix=/path/to/install
make -j10
make install
@weimeng23
weimeng23 / logger.py
Created January 31, 2024 10:04
python useful logger
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(filename)s | %(threadName)s | %(funcName)s | %(lineno)s | %(message)s')
fh = logging.FileHandler("log.txt")
fh.setLevel(logging.INFO)
fh.setFormatter(formatter)
logger.addHandler(fh)
@weimeng23
weimeng23 / export_bert_onnx.py
Last active January 30, 2024 03:27
export onnx model
class MyBertForSequenceClassification(BertForSequenceClassification):
def forward(self, input_ids=None, attention_mask=None, token_type_ids=None):
outputs = super().forward(
input_ids=input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
)
return outputs.logits
@weimeng23
weimeng23 / M365Princess.omp.json
Created November 29, 2023 03:40
oh my posh add conda Venv to prompt
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"palette": {
"white": "#FFFFFF",
"tan": "#CC3802",
"teal": "#047E84",
"plum": "#9A348E",
"blush": "#DA627D",
"salmon": "#FCA17D",
"sky": "#86BBD8",
@weimeng23
weimeng23 / 24-bit-truecolor.sh
Last active November 23, 2023 08:07
test if your terminal supports 24 bit truecolor
#!/bin/bash
#
# This file echoes four gradients with 24-bit color codes
# to the terminal to demonstrate their functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
SEPARATOR=':'
@weimeng23
weimeng23 / kaldi_io_mechanisms.py
Last active May 4, 2023 06:50
kaldi command pipeline expression in python
delta_command = "compute-mfcc-feats --config=conf/mfcc.conf scp,p:wav_test.scp ark:- | add-deltas ark:- ark:- |"
delta_feats_rspecifier = (
f'ark:{delta_command}'
)
mfcc_command = "compute-mfcc-feats --config=conf/mfcc.conf scp,p:wav_test.scp ark:- |"
mfcc_feats_rspecifier = (
f'ark:{mfcc_command}'
)
@weimeng23
weimeng23 / read_wav_pcm.py
Last active April 12, 2023 02:36
read raw pcm & wav in several method
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : read_wav_pcm.py
# Author : Meng Wei <wmeng94@gmail.com>
# Date : 23.03.2023
# Last Modified Date: 23.03.2023
# Last Modified By : Meng Wei <wmeng94@gmail.com>
import librosa
import numpy as np
@weimeng23
weimeng23 / mngw-w64_boost.MD
Created February 26, 2022 06:33 — forked from zrsmithson/mngw-w64_boost.MD
Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Introduction

Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.

Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow

Get files needed for install

Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
__Note: This should work perfectly w

05/05/2018

2018: Speech2Vec: A Sequence-to-Sequence Framework for Learning Word Embeddings from Speech

Projects audio files that contains one word of speech into a hyper-dimension space just like Word2Vec. Uses "Force Aligment" to split audio into words (which requires text). Pad the audio segments with zeros, do MFCC, feed into encoder-decoder which uses RMSE. They also add noise to the signal and make the network denoise it. LibriSpeech 500 hour of audio. Not sure how it can incorporated in an ASR or TTS systems. The audio file has to be paired with a text otherwise Speech2Vec cannot split the audio file into words using "Forced Alignment" method. It is used to query if the spoken word is similar to an existing word in the corpus.

2016: Neural Machine Translation of Rare Words with Subword Units (BPE)

BPE data compression tool that combines most frequent pair of bytes with one. It works well with Named Entity, loadwords and morphologically complex words. Handles OOVs well and rare words. You can