Skip to content

Instantly share code, notes, and snippets.

@1duo
1duo / centos.install.cmake.from.source.md
Last active April 23, 2024 15:58
Install CMake on CentOS 7.

Download CMake from: https://cmake.org/download/

wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz

Compile from source and install

tar zxvf cmake-3.*
@jeasinema
jeasinema / weight_init.py
Last active May 25, 2023 09:32
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''
@yevrah
yevrah / Upgrade vim
Last active September 25, 2023 05:11
Update to Vim8 on Centos 7
################################################################################
# Method 1: Install using rpm packages (credit to DarkMukke)
#
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
# WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step
# make sure to at least run `yum install sudo`
yum -y remove vim-minimal vim-common vim-enhanced
@cheind
cheind / hmm_train_tf.py
Last active December 5, 2022 07:20
HMM training based on gradient descent (Tensorflow version)
__author__ = 'Christoph Heindl'
__copyright__ = 'Copyright 2017'
__license__ = 'BSD'
"""Trains a HMM based on gradient descent optimization.
The parameters (theta) of the model are transition and
emission probabilities, as well as the initial state probabilities.
Given a start solution, the negative log likelihood of data given the
@higepon
higepon / seq2seq.py
Last active August 1, 2023 09:05
Minimum Seq2Seq implementation using Tensorflow 1.4/1.5 API
import numpy as np
import tensorflow as tf
from tensorflow.python.layers import core as layers_core
hparams = tf.contrib.training.HParams(
batch_size=3,
encoder_length=4,
decoder_length=5,
num_units=6,
src_vocab_size=7,

深度学习于语音合成研究综述

本文综述近年来深度学习用于语音合成的一些方法。

WaveNet

在自回归生成模型在图像和文本领域广泛应用的时候,WaveNet [4] 尝试将这些思想应用于语音领域。仿照PixelRNN (van den Oord et al., 2016)图像生成的做法, WaveNet依据之前采样点来生成下一个采样点。生成下一个采样点的模型为CNN结构。为了生成指定说话人的声音,以及生成指定文本的声音,引入了全局条件和局部条件,来控制合成内容。为了扩大感受野,带洞卷积,使filter的按照指数扩张。

WaveNet存在的问题是,1) 每次预测一个采样点,速度太慢;2)如果用于TTS,那初始采样点选择将会很重要;3)以及需要文本前端的支持,前端分析出错,将直接影响合成效果。

@peterroelants
peterroelants / mnist_estimator.py
Last active February 14, 2024 11:26
Example using TensorFlow Estimator, Experiment & Dataset on MNIST data.
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
from tensorflow.contrib.learn import learn_runner
# Show debugging output
@awni
awni / ctc_decoder.py
Last active June 1, 2024 14:21
Example CTC Decoder in Python
"""
Author: Awni Hannun
This is an example CTC decoder written in Python. The code is
intended to be a simple example and is not designed to be
especially efficient.
The algorithm is a prefix beam search for a model trained
with the CTC loss function.
@jihunchoi
jihunchoi / masked_cross_entropy.py
Last active January 22, 2024 19:20
PyTorch workaround for masking cross entropy loss
def _sequence_mask(sequence_length, max_len=None):
if max_len is None:
max_len = sequence_length.data.max()
batch_size = sequence_length.size(0)
seq_range = torch.range(0, max_len - 1).long()
seq_range_expand = seq_range.unsqueeze(0).expand(batch_size, max_len)
seq_range_expand = Variable(seq_range_expand)
if sequence_length.is_cuda:
seq_range_expand = seq_range_expand.cuda()
seq_length_expand = (sequence_length.unsqueeze(1)
@cloverstd
cloverstd / install.sh
Last active April 10, 2021 13:51
install libtorrent and python binds on centos 7
yum install -y boost boost-devel
yum install -y make gcc gcc-c++ kernel-devel python-devel
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_10/libtorrent-rasterbar-1.0.10.tar.gz
tar zxvf libtorrent-rasterbar-1.0.10.tar.gz
cd libtorrent-rasterbar-1.0.10.tar.gz
./configure --disable-debug --with-boost-libdir=/usr/lib64 --disable-encryption --enable-python-binding
make && make install
export LD_LIBRARY_PATH=/usr/local/lib/
cd bindings/python
python setup.py build