This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void demucscpp::common_encoder_layer( | |
Eigen::Tensor3dXf &q, // q = x = frequency | |
const Eigen::Tensor3dXf &k, // k = xt = time | |
const Eigen::Tensor1dXf &norm1_weight, const Eigen::Tensor1dXf &norm1_bias, | |
const Eigen::Tensor1dXf &norm2_weight, const Eigen::Tensor1dXf &norm2_bias, | |
const Eigen::MatrixXf &in_proj_weight, const Eigen::VectorXf &in_proj_bias, | |
const Eigen::MatrixXf &out_proj_weight, | |
const Eigen::VectorXf &out_proj_bias, const Eigen::VectorXf &gamma1_scale, | |
const Eigen::Tensor1dXf &norm3_weight, const Eigen::Tensor1dXf &norm3_bias, | |
const Eigen::MatrixXf &linear1_weight, const Eigen::VectorXf &linear1_bias, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eigen::Tensor3dXf demucscpp::layer_norm_last_dim(const Eigen::Tensor3dXf &x, | |
const Eigen::Tensor1dXf &weight, | |
const Eigen::Tensor1dXf &bias, | |
const float eps=1e-5) { | |
// compute layer norm across last dimension | |
// eps is typically 1e-5 | |
// | |
// e.g. x = (A, B, C) | |
// w = (C) | |
// b = (C) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# script for bootstrapping an '$mdx.cpp' project | |
# mdx = music demixing | |
# e.g. umx.cpp (open-unmix) | |
# demucs.cpp (Demucs) | |
set -Eou pipefail | |
set -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy | |
import itertools | |
import soundfile | |
import sys | |
import multiprocessing | |
import argparse | |
sample_rate = 44100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.fft | |
import cupyx | |
import cupy | |
# managed memory to stream large ndarrays to cuda | |
cupy.cuda.set_allocator(cupy.cuda.MemoryPool(cupy.cuda.memory.malloc_managed).malloc) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bit_vec::BitVec; | |
use std::hash::{Hash, Hasher}; | |
// use 4 hash functions | |
use ahash::AHasher; | |
use fnv::FnvHasher; | |
use metrohash::MetroHash64; | |
use siphasher::sip::SipHasher; | |
pub struct BloomFilter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
quadtree.py | |
A matrix implementation based on a pointer region quadtree, implemented in pure Python. | |
The script takes a scipy sparse matrix format as the only argument and calls 'eval' to use that format as the control matrix. | |
See: https://docs.scipy.org/doc/scipy/reference/sparse.html | |
Several sizes and densities are tested (all matrices are square). Measured: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <algorithm> | |
#include <cctype> | |
#include <fstream> | |
#include <string> | |
#define PROC_STR "/proc/%s/stat" | |
pid_t | |
_getpppid(const char *, int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from collections import Counter | |
import numpy | |
from PIL import Image | |
from webcolors import css3_hex_to_names, hex_to_rgb | |
from urllib.request import urlopen | |
import sys | |
import time | |
import matplotlib.pylab as plb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.6 | |
import sys, os, signal, readline | |
signal.signal(signal.SIGINT, signal.default_int_handler) | |
P = {'pid': ['state', 'ppid', 'name'], os.getpid(): ['0', os.getppid(), sys.argv[0]]} | |
W = {'worm-ps': lambda _: [print(f"{k}\t{v[1]}\t{v[0]}\t{' '.join(v[2:])}") for k, v in P.items()], | |
'worm-kill': lambda a: os.kill(int(a[1]), int(a[2])) if len(a) == 3 else print('usage: worm-kill pid sig', file=sys.stderr), | |
'worm-history': lambda _: print('\n'.join([(readline.get_history_item(i)) for i in range(readline.get_current_history_length()) if readline.get_history_item(i)])), |
NewerOlder