Skip to content

Instantly share code, notes, and snippets.

View minesh1291's full-sized avatar
🚖
On The Journey to Neverland

Minesh A. Jethva minesh1291

🚖
On The Journey to Neverland
View GitHub Profile
@minesh1291
minesh1291 / VNC_Server_On_Ubuntu_22.04LTS.md
Created March 8, 2025 17:20 — forked from indyfromoz/VNC_Server_On_Ubuntu_22.04LTS.md
VNC Server setup on Ubuntu 22.04 LTS

Setup

Install TigerVNC -

$ sudo apt install tigervnc-standalone-server

Configure VNC Server by running

@minesh1291
minesh1291 / failed_login_attempts.sh
Last active March 14, 2025 14:22
Failed login attempts Linux
#!/bin/bash
# Check if the script is run with root privileges
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
# Determine the log file based on the distribution
if [ -f /var/log/auth.log ]; then
@minesh1291
minesh1291 / grpo_demo.py
Created February 1, 2025 03:28 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
import numpy as np
from sklearn.linear_model import SGDClassifier
from sklearn.datasets import make_classification
from sklearn.metrics import log_loss
import matplotlib.pyplot as plt
np.random.seed(42)
# Create synthetic classification dataset
X, y = make_classification(
n_samples=500, n_features=50, n_informative=15, random_state=42
@minesh1291
minesh1291 / SampleWeights_Regression.py
Last active May 18, 2024 16:07
SampleWeights_Regression.py
import pandas as pd
import numpy as np
# Example DataFrame with random target values
df = pd.DataFrame({
'label': np.random.normal(size=1000) # 100 random values between 0 and 1
})
# Step 1: Bin the target values to create a frequency distribution
df['label_bin'] = pd.cut(df['label'], bins=10)
@minesh1291
minesh1291 / vae_pytorch_lightning.ipynb
Created May 16, 2024 04:42
Vae_pytorch_lightning.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@minesh1291
minesh1291 / MoE.py
Created May 4, 2024 11:55 — forked from ruvnet/MoE.py
A PyTorch implementation of a Mixture of Experts (MoE) model resembling the Mixtral 8x7B architecture, with detailed inline comments. This model combines transformer layers with an MoE layer consisting of 8 experts, aiming for high efficiency by activating only 2 experts per token. It's configured with dimensions reflecting the operational effic…
"""
This model integrates the MoE concept within a Transformer architecture. Each token's
representation is processed by a subset of experts, determined by the gating mechanism.
This architecture allows for efficient and specialized handling of different aspects of the
data, aiming for the adaptability and efficiency noted in the Mixtral 8x7B model's design
philosophy. The model activates only a fraction of the available experts for each token,
significantly reducing the computational resources needed compared to activating all experts
for all tokens.
"""
@minesh1291
minesh1291 / ecg_forecast.py
Created April 27, 2024 11:45
Distribution Forecasting 
# %%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.signal
from gluonts.dataset.repository import get_dataset, dataset_names
from gluonts.dataset.util import to_pandas
from gluonts.dataset.common import ListDataset
from gluonts.torch import SimpleFeedForwardEstimator
from lightning.pytorch.callbacks.early_stopping import EarlyStopping
@minesh1291
minesh1291 / load_m5_gluonts.py
Created April 24, 2024 05:47 — forked from lostella/load_m5_gluonts.py
Loading M5 competition data into a gluonts PandasDataset
# Works on gluonts dev branch as of May 30th, 2023
# Assumes "m5-forecasting-accuracy" folder with data next to the script
# Data is obtained from https://www.kaggle.com/c/m5-forecasting-accuracy
import pandas as pd
from pathlib import Path
from gluonts.dataset.pandas import PandasDataset
# Load data from csv files
@minesh1291
minesh1291 / bokeh_subprocess_test.py
Created November 29, 2023 15:26 — forked from ruoyu0088/bokeh_subprocess_test.py
a demo for zmq process with bokeh server
from os import path
from bokeh.models import Button, Div
from bokeh.layouts import column
from bokeh.document import without_document_lock
from bokeh.io import curdoc
from zmq_subprocess import ZmqSubProcessClient
ok_button = Button(label="ok")
div = Div()