Skip to content

Instantly share code, notes, and snippets.

View mthrok's full-sized avatar
💭
🛵

moto mthrok

💭
🛵
View GitHub Profile
@mthrok
mthrok / Dockerfile
Last active January 26, 2023 16:51
TorchAudio 0.10.2 minimum compilation example
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04
ARG PYTHON_VERSION=3.9
ARG CU_VERSION=11.3
ARG PYTORCH_VERSION=1.10.2
ARG TORCHAUDIO_TAG=v0.10.2
RUN apt update && apt install -y -qq git curl && apt autoremove && apt autoclean
RUN git clone https://github.com/pytorch/audio.git
@mthrok
mthrok / compare_mel_filterbank.py
Last active February 19, 2024 08:30
Compare spectrograms of torchaudio and librosa
import torch
import torchaudio
import librosa
import matplotlib.pyplot as plt
from torchaudio.functional import create_fb_matrix
n_fft = 2048
n_mels = 128
sample_rate = 6000
@mthrok
mthrok / my_melspec.py
Last active September 18, 2022 11:35 — forked from eldrin/my_melspec.py
Quick digging in what makes the mel-spectrum discrepancy between torch audio and librosa
import math
from typing import Callable, Optional
from warnings import warn
import librosa
import torch
from torch import Tensor
from torchaudio import functional as F
from torchaudio import transforms as T
from torchaudio.compliance import kaldi
@mthrok
mthrok / iterate_sox_encodings.sh
Created February 11, 2021 00:05
Generate various audio formats with sox, changing parameters
#!/usr/bin/env bash
base_dir="tmp/test_sox"
mkdir -p "${base_dir}"
base_file="${base_dir}/base.wav"
sox --rate 8000 --channels 1 --null "${base_file}" synth 1 sawtooth 1
for type in wav mp3 flac vorbis sph amr-nb amb gsm htk; do
for encoding in no_encoding signed-integer unsigned-integer floating-point mu-law a-law; do
prefix="${base_dir}/${type}/${encoding}"
# From Ubuntu 14.04 clean installation
# Install Caffe Dependencies as explained in Caffe doc
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Install DeepTerrainRL Dependencies
sudo apt-get install libgl1-mesa-dev-lts-trusty libglew-dev freeglut3-dev
epoch phase steps nr_games average_reward min_game_reward max_game_reward last_exploration_rate total_train_steps replay_memory_count meanq meancost weight_updates total_time epoch_time steps_per_second
0 random 50000 318 48.427672955974856 0 410 1 0 50000 0.0290023 0 0 51.305532 51.305451 974.5553157694686
1 train 250000 1631 48.10545677498466 0 410 0.7750009 250000 300000 0.848738 0.011493682704998764 62500 758.254548 706.916116 353.64874889908435
1 test 125000 331 118.85196374622359 35 475 0.05 250000 300000 0.848738 0 62500 1080.655029 322.38594 387.7340308327342
2 train 250000 1509 65.43074884029161 0 735 0.5500008999999999 500000 550000 1.84968 0.0077018891526642701 125000 1890.091967 809.434964 308.85742662334513
2 test 125000 182 147.17032967032964 30 440 0.05 500000 550000 1.84968 0 125000 2208.5919830000003 318.4854640000001 392.48259066542505
3 train 250000 1459 79.64359150102806 0 505 0.32500090000000004 750000 800000 2.54251 0.0060853225424165741 187500 3117.1898290000004 908.5958740000001 275.14
@mthrok
mthrok / simple_dqn_breakout_lives.csv
Last active September 23, 2016 17:56
simple_dqn_breakout_lives.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 16 columns, instead of 15 in line 6.
epoch,phase,steps,nr_games,average_reward,min_game_reward,max_game_reward,last_exploration_rate,total_train_steps,replay_memory_count,meanq,meancost,weight_updates,total_time,epoch_time,steps_per_second
0,random,50000,1534,0.20143415906127782,0,4,1,0,50000,0.0233275,0,0,73.598242,73.59814,679.36499482188
1,train,250000,7422,0.27081649151172227,0,8,0.7750009,250000,300000,0.311701,0.0020945143056795832,62500,897.081201,823.461151,303.5965931075236
1,test,125000,293,2.0204778156996586,2,3,0.05,250000,300000,0.311701,0,62500,1223.4046580000002,326.30875100000003,383.07277882351366
2,train,250000,5438,0.6870172857668253,0,7,0.5500008999999999,500000,550000,1.15778,0.002124980911281495,125000,2113.3601790000002,889.953559,280.91353472524287
2,test,125000,341,8.252199413489743,2,30,0.05,500000,550000,1.15778,0,125000,2442.4487400000003,329.0744830000003,379.8532139606822
3,train,250000,3687,1.3037700027122328,0,12,0.32500090000000004,750000,800000,1.33192,0.0025958452892911803,187500,3404.4243850000003,961.97368000
epoch phase steps nr_games average_reward min_game_reward max_game_reward last_exploration_rate total_train_steps replay_memory_count meanq meancost weight_updates total_time epoch_time steps_per_second
0 random 50000 280 1.1392857142857133 0 6 1 0 50000 0.0556025 0 0 52.79143 52.791329 947.1252371767341
1 train 250000 1368 1.2675438596491242 0 8 0.7750009 250000 300000 0.339661 0.0018220655856809639 62500 765.9333250000001 713.109987 350.57705621503237
1 test 125000 524 3.6488549618320634 0 11 0.05 250000 300000 0.339661 0 62500 1097.69735 331.751842 376.78765925284597
2 train 250000 1002 3.49301397205589 0 14 0.5500008999999999 500000 550000 1.19563 0.0017440362257331581 125000 1897.285126 799.585801 312.6618802976968
2 test 125000 251 14.247011952191237 9 24 0.05 500000 550000 1.19563 0 125000 2221.2259830000003 323.9288630000001 385.88719400407354
3 train 250000 730 6.271232876712325 0 26 0.32500090000000004 750000 800000 1.38715 0.00076938667534075418 187500 3109.9805810000003 888.7526130000001 281.29312
epoch phase steps nr_games average_reward min_game_reward max_game_reward last_exploration_rate total_train_steps replay_memory_count meanq meancost weight_updates total_time epoch_time steps_per_second
0 random 50000 277 1.1407942238267148 0 6 1 0 50000 0.112446 0 0 52.50241 52.502328 952.3387229610086
1 train 250000 1377 1.1946259985475687 0 8 0.7750009 250000 300000 0.171563 0.0018099111913436672 62500 787.659543 735.131274 340.0753155823432
1 test 125000 188 8.835106382978726 1 12 0.05 250000 300000 0.171563 0 62500 1135.233281 347.5609679999999 359.64913068144074
2 train 250000 1320 1.4469696969696961 0 10 0.5500008999999999 500000 550000 0.251034 0.00028861318585622896 125000 1935.7828510000002 800.547384 312.28632432830483
2 test 125000 574 0.11324041811846683 0 3 0.05 500000 550000 0.251034 0 125000 2292.1107629999997 356.31553599999984 350.81265723984615
3 train 250000 1257 2.1113762927605424 0 13 0.32500090000000004 750000 800000 0.363649 0.00017119690073510134 187500 3186.594698 894.4817389999998 2