Skip to content

Instantly share code, notes, and snippets.

View weimeng23's full-sized avatar
🤩
Focusing

Meng Wei weimeng23

🤩
Focusing
  • Beijing
  • 16:13 (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 / 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

@weimeng23
weimeng23 / ssh.md
Last active January 2, 2020 08:49 — forked from suziewong/ssh.md
SSH端口转发

ssh

    -C  压缩数据传输
    -f  后台登录用户名密码
    -N  不执行shell[与 -g 合用]
    -g  允许打开的端口让远程主机访问        
    -L  本地端口转发
    -R  远程端口转发
    -p  ssh 端口