Skip to content

Instantly share code, notes, and snippets.

View PrithivirajDamodaran's full-sized avatar
🏠
Working from home

Prithivida PrithivirajDamodaran

🏠
Working from home
View GitHub Profile
@PrithivirajDamodaran
PrithivirajDamodaran / bgem3_hindi_miracl.txt
Created April 28, 2024 03:39
BGE-M3 Spot check on MIRACL Hindi Dev set
/usr/local/lib/python3.10/dist-packages/torch/distributed/launch.py:183: FutureWarning: The module torch.distributed.launch is deprecated
and will be removed in future. Use torchrun.
Note that --use-env is set by default in torchrun.
If your script expects `--local-rank` argument to be set, please
change it to read from `os.environ['LOCAL_RANK']` instead. See
https://pytorch.org/docs/stable/distributed.html#launch-utility for
further instructions
warnings.warn(
2024-04-27 16:05:43.073043: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
@PrithivirajDamodaran
PrithivirajDamodaran / get_gpu_driver_info.py
Last active July 8, 2023 12:12
Get NVIDIA Device Driver details
# Run the below if you get no file or command lspci
# !sudo apt-get install pciutils
import subprocess
def get_gpu_driver_info():
# Find the GPU's chip name
lspci_output = subprocess.check_output(["lspci", "-nn"]).decode()
gpu_info_line = next((line for line in lspci_output.split('\n') if '3D controller' in line and 'NVIDIA' in line), None)
print(f"GPU Information: {gpu_info_line}")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.stats import binom
n = [1,2,10,15,25,50]
p = 0.5
j = 0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.stats import binom
n = [1,2,10,15,25,50]
p = 0.5
j = 0

Serving Encoder-Decoder Models using TF Serving

Prithiviraj Damodaran

Step1 : Save Models/Weights

import tensorflow as tf
from tensorflow.keras.models import model_from_json
from tensorflow.keras.models import load_model
@PrithivirajDamodaran
PrithivirajDamodaran / enron_data_splitter.py
Created May 10, 2019 13:08
Enron email dataset splitter/formatter
# Assumes you have the enron email dataset as emails.csv
import pandas as pd
data = pd.read_csv("emails.csv")
pd.set_option('display.max_colwidth',-1)
new = data["message"].str.split("\n", n = 15, expand = True)
data["from"] = new[2]
data["fromn"] = new[8]
data["to"] = new[3]
@PrithivirajDamodaran
PrithivirajDamodaran / Index.html
Created March 25, 2018 19:35
Open Data engineering
<html>
<head>
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Noto+Sans:400,700');
body{
background: #f0f0f0;
font-family: 'Noto Sans', sans-serif;
@PrithivirajDamodaran
PrithivirajDamodaran / big.txt
Created June 16, 2017 11:35
Toy version of Peter Norvig's big.txt for testing multiwordspellchecker.py
This file has been truncated, but you can view the full file.
The Project Gutenberg EBook of The Adventures of Sherlock Holmes
by Sir Arthur Conan Doyle
(#15 in our series by Sir Arthur Conan Doyle)
Copyright laws are changing all over the world. Be sure to check the
copyright laws for your country before downloading or redistributing
this or any other Project Gutenberg eBook.
This header should be the first thing seen when viewing this Project
Gutenberg file. Please do not remove it. Do not change or edit the
# by Prithiviraj Damodaran
# Based on Peter Norvig’s blog post and toy spell correction logic
from __future__ import division
from memo import memo
import re
from collections import Counter
def words(text): return re.findall(r'\w+', text.lower())

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.