Skip to content

Instantly share code, notes, and snippets.

View r9y9's full-sized avatar
:shipit:
( ˘ω˘ ) zzz

Ryuichi Yamamoto r9y9

:shipit:
( ˘ω˘ ) zzz
View GitHub Profile
@taroushirani
taroushirani / spsvsmod.py
Created May 3, 2022 07:30
CLI for NNSVS packed model
#! /usr/bin/python
import argparse
import logging
from nnmnkwii.io import hts
from nnsvs.dsp import bandpass_filter
from nnsvs.gen import (
gen_spsvs_static_features,
gen_world_params,
postprocess_duration,
import pyworld as pw
import pysptk
from scipy.io import wavfile
import numpy as np
fs, x = wavfile.read(pysptk.util.example_audio_file())
assert fs == 16000
wavfile.write('./orig.wav', fs, x)
# shortからfloatに変換します
@davidaknowles
davidaknowles / torch_pixel_shuffle1d.py
Created August 20, 2019 19:23
torch currently only supports 2d pixel shuffle from https://arxiv.org/abs/1609.05158. This is the 1d version.
def pixel_shuffle_1d(x, upscale_factor):
batch_size, channels, steps = x.size()
channels //= upscale_factor
input_view = x.contiguous().view(batch_size, channels, upscale_factor, steps)
shuffle_out = input_view.permute(0, 1, 3, 2).contiguous()
return shuffle_out.view(batch_size, channels, steps * upscale_factor)
@carlthome
carlthome / Signal reconstruction from spectrograms.ipynb
Created May 31, 2018 13:53
Try to recover audio from filtered magnitudes when phase information has been lost.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@snowyday
snowyday / eve.py
Last active January 16, 2018 04:26
Eve: Improving Stochastic Gradient Descent with Feedback
import math
from torch.optim import Optimizer
class Eve(Optimizer):
"""Implements Eve (Adam with feedback) algorithm.
It has been proposed in `Improving Stochastic Gradient Descent with Feedback, `_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
@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)
@kastnerkyle
kastnerkyle / extract_feats.py
Last active December 12, 2022 21:27
Extract features with HTK/speech_tools/festival/merlin
from __future__ import print_function
import os
import shutil
import stat
import subprocess
import time
import numpy as np
from scipy.io import wavfile
import re
import glob
@brannondorsey
brannondorsey / pix2pix_paper_notes.md
Last active January 3, 2022 09:57
Notes on the Pix2Pix (pixel-level image-to-image translation) Arxiv paper

Image-to-Image Translation with Conditional Adversarial Networks

Notes from arXiv:1611.07004v1 [cs.CV] 21 Nov 2016

  • Euclidean distance between predicted and ground truth pixels is not a good method of judging similarity because it yields blurry images.
  • GANs learn a loss function rather than using an existing one.
  • GANs learn a loss that tries to classify if the output image is real or fake, while simultaneously training a generative model to minimize this loss.
  • Conditional GANs (cGANs) learn a mapping from observed image x and random noise vector z to y: y = f(x, z)
  • The generator G is trained to produce outputs that cannot be distinguished from "real" images by an adversarially trained discrimintor, D which is trained to do as well as possible at detecting the generator's "fakes".
  • The discriminator D, learns to classify between real and synthesized pairs. The generator learns to fool the discriminator.
  • Unlike an unconditional GAN, both th
@bskinn
bskinn / intersphinx_mappings.txt
Last active March 28, 2024 18:04
Various intersphinx mappings
# The entries in this file are checked regularly for validity via the Github Action
# sited at github.com/bskinn/intersphinx-gist.
# Please feel free to post an issue at that repo if any of these mappings don't work for you,
# or if you're having trouble constructing a mapping for a project not listed here.
Python 3 [latest]: ('https://docs.python.org/3/', None)
Python 3 [3.x]: ('https://docs.python.org/3.9/', None)
attrs [stable]: ('https://www.attrs.org/en/stable/', None)
Django [dev]: ('https://docs.djangoproject.com/en/dev/', 'https://docs.djangoproject.com/en/dev/_objects/')
Flask [2.2.x]: ('https://flask.palletsprojects.com/en/2.2.x/', None)