Skip to content

Instantly share code, notes, and snippets.

View sourabh2k15's full-sized avatar
🎯
Focusing

sourabh2k15 sourabh2k15

🎯
Focusing
View GitHub Profile
#@title FFT Layer
"""Flax layer to perform preprocessing on librispeech audio inputs.
This layer computes windowed short time fourier transform over audio signals
then converts it to mel scale and finally takes a logarithm of resulting
mel spectrograms and normalizes it to be used in speech recognition models.
This code is based on lingvo's librispeech preprocessing code here:
https://github.com/tensorflow/lingvo/blob/master/lingvo/tasks/asr/frontend.py
JAX training steps progress :
0) loss = 32.684505462646484 grad_norm = 46.189605712890625
1) loss = 32.684505462646484 grad_norm = 46.189605712890625
2) loss = 32.2853889465332 grad_norm = 47.51691818237305
3) loss = 31.46957778930664 grad_norm = 49.439979553222656
4) loss = 30.260791778564453 grad_norm = 53.63009262084961
5) loss = 28.776248931884766 grad_norm = 58.055015563964844
6) loss = 27.165119171142578 grad_norm = 73.13194274902344
7) loss = 25.350372314453125 grad_norm = 83.24612426757812
@sourabh2k15
sourabh2k15 / gist:b960dbde6e965fb4137765e66ad08c15
Created October 14, 2022 22:06
conformer jax mlcommons run
global_step,test/ctc_loss,test/wer,train/ctc_loss,train/wer,validation/ctc_loss,validation/wer,score
1,30.24002,1.1590399418146555,32.369118,1.0535290080768622,30.846983,1.1507724619108644,
528,5.9877963,0.8947815019092066,6.026844,0.9461873981817226,6.1750135,0.8924567737032111,
1062,6.1004605,0.8944582499949492,6.3094215,0.9392578586622548,6.2672987,0.8986089921924078,
1598,4.909699,0.8416267652585006,4.9721985,0.8754789272030651,5.293022,0.852067526555387,
2124,3.8002286,0.7468331414025092,3.7078342,0.7777719500681842,4.0218964,0.7641824646666786,
2651,2.7804344,0.6221387154777057,2.787846,0.6536303051560856,3.2950375,0.6540194987648268,
3176,1.7282625,0.4829585631452411,1.7336979,0.5041396285522488,1.9899195,0.5062177017329219,
3703,1.1341795,0.3567286906277148,1.0678067,0.3458033573141487,1.6042109,0.4285113463894527,
4227,0.7807562,0.2609047012950279,0.6385119,0.2235402865506085,1.0614083,0.315793368857312,
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc
sudo apt-get install libxml2
sudo apt-get install make
sudo apt-get install python3-pip
sudo apt-get install git
sudo apt-get install tmux
This file has been truncated, but you can view the full file.
Thread 767 (Thread 0x7f8a0933a700 (LWP 54659)):
#0 futex_wait_cancelable (private=0, expected=0, futex_word=0x7f868797a358) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1 __pthread_cond_wait_common (abstime=0x0, mutex=0x7f868797a360, cond=0x7f868797a330) at pthread_cond_wait.c:502
#2 __pthread_cond_wait (cond=0x7f868797a330, mutex=0x7f868797a360) at pthread_cond_wait.c:655
#3 0x00007fb6a13d9f18 in persistentThread(void*) () from /home/smedapati_google_com/mlcommons2/lib/python3.7/site-packages/jaxlib/xla_extension.so
#4 0x00007fb780c87fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#5 0x00007fb780a1feff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
@sourabh2k15
sourabh2k15 / 76-Minimum_Window_Substring.cpp
Last active March 20, 2022 16:27
Leetcode 76. Minimum Window Substring
class Solution {
public:
string minWindow(string s, string t) {
unordered_map<char, int> table;
// initialize frequency table for t
for(char c : t){
table[c]++;
}
@sourabh2k15
sourabh2k15 / preorder.cpp
Last active June 14, 2021 05:37
Leetcode 144. Binary Tree Preorder Traversal. Using stack to perform DFS
class Solution {
public:
// DFS magic : initialize stack and do the following
// pop top, retrieve neighbours for top, push unvisited neighbours to stack | repeat while stack not empty
// because this is a tree no need to keep track of visited as no cycles possible.
vector<int> preorderTraversal(TreeNode* root) {
stack<TreeNode*> s;
vector<int> result;
void levelOrder(TreeNode* root) {
queue<TreeNode*> bfs;
bfs.push(root);
while(!bfs.empty()){
TreeNode* current = bfs.front(); bfs.pop();
if(current){
cout << current->val << " ";
@sourabh2k15
sourabh2k15 / countComponents.cpp
Last active January 5, 2020 22:34
Leetcode 323. Number of Connected Components in an Undirected Graph
class Solution {
public:
int countComponents(int n, vector<pair<int, int>>& edges) {
vector<bool> visited(n, false);
vector<vector<int>> adjList(n, vector<int>(0));
stack<int> dfs;
int count = 0;
int ans = 0;
@sourabh2k15
sourabh2k15 / 78-Subsets-Iterative.cpp
Last active February 22, 2019 05:33
Leetcode 78-Subsets Iterative solution
class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> powerset;
powerset.push_back(vector<int>(0));
// after each iteration of this loop we are left with the powerset of the subset nums[0..i]
for(int i = 0; i < nums.size(); i++){
// append nums[i] to already recorded subsets to form new ones.