Skip to content

Instantly share code, notes, and snippets.

View imohitmayank's full-sized avatar

Mohit imohitmayank

View GitHub Profile
@imohitmayank
imohitmayank / training_llm_neural_codec_tts_model.py
Last active November 8, 2025 03:54
Training LLM-Based + Neural Codec TTS Models
# %%
# !pip install -q trl
# %%
import os
os.environ["WANDB_PROJECT"] = "gemma3-snac-finetuning"
os.environ["WANDB_LOG_MODEL"] = "checkpoint"
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
@imohitmayank
imohitmayank / gist:cead7ad4a63c8770bbd5a8f48d25aeeb
Created November 5, 2025 15:18
Test Different LORA Adapter Saved Sizes
#!/usr/bin/env python3
"""
Script to test the size of saved models with different LoRA configurations:
1. Normal LoRA (attention layers only)
2. LoRA with embedding space adapter (modules_to_save)
3. LoRA with trainable_token_indices (specific token indices)
4. LoRA with new tokens added (train only new tokens)
Requirements:
pip install transformers peft torch
@imohitmayank
imohitmayank / Guide to Custom Recurrent Modeling in Keras.ipynb
Created November 14, 2020 09:33
Complimentary code for "Guide to Custom Recurrent Modeling in Keras" article by Mohit Mayank
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imohitmayank
imohitmayank / node2vec_karateclub_eval.ipynb
Created August 4, 2020 16:26
To test the node2vec model of KarateClub on the LesMiserable graph (as reported in paper)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imohitmayank
imohitmayank / bezier_curve.py
Created August 4, 2019 08:40
Draw bezier curve using Processing.py
# Libraries
import time
# Points
p = [{"x" : 100, "y" : 300}, {"x" : 500, "y" : 100}, {"x" : 700, "y" : 300}]
# default values
prev_x = p[0]['x']
prev_y = p[0]['y']
t = 0
@imohitmayank
imohitmayank / edit_distance.py
Created April 16, 2019 19:06
edit distance
import numpy as np
def editdistance(str1, str2):
# define
m, n = len(str1) + 1, len(str2) + 1
table = np.empty([m, n])
for i in range(m):
table[i, 0] = i
for j in range(n):
table[0, j] = j
for i in range(1, m):
@imohitmayank
imohitmayank / fibonaci_number_memo.py
Last active April 16, 2019 18:07
Fibonacci number - memoization
memory = {0: 0, 1: 1}
def fib(n):
if n in memory.keys():
return(memory[n])
else:
memory[n] = fib(n-1) + fib(n-2)
return memory[n]
@imohitmayank
imohitmayank / fibonaci_number.py
Created April 16, 2019 17:51
Fibonacci number
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
# The status of the solution is printed to the screen
print("Status:", LpStatus[prob.status])
# Output=
# Status: Optimal
# Each of the variables is printed with it's resolved optimum value
for v in prob.variables():
print(v.name, "=", v.varValue)
# Output=
# Medicine_1_units = 3.0