Skip to content

Instantly share code, notes, and snippets.

View pbamotra's full-sized avatar
🎯
Focusing

Pankesh Bamotra pbamotra

🎯
Focusing
View GitHub Profile
@pbamotra
pbamotra / dali-1.6.py
Created July 3, 2019 21:12
DALI Post-1.6
eii = ExternalInputIterator(batch_size=16,
data_file=processed_data_file,
image_dir=images_directory)
iterator = iter(eii)
class ExternalSourcePipeline(Pipeline):
def __init__(self, data_iterator, batch_size, num_threads, device_id):
super(ExternalSourcePipeline, self).__init__(batch_size,
num_threads,
device_id,
@pbamotra
pbamotra / dali-1.7.py
Created July 3, 2019 21:13
DALI Post-1.7
from nvidia.dali.plugin.pytorch import DALIGenericIterator
pipe = ExternalSourcePipeline(data_iterator=iterator, batch_size=16, num_threads=2, device_id=0)
pipe.build()
# first parameter is list of pipelines to run
# second pipeline is output_map that maps consecutive outputs to
# corresponding names
# last parameter is the number of iterations - number of examples you
# want to iterate on
@pbamotra
pbamotra / save-code-to-tarball.py
Last active March 7, 2020 12:35
Save code snapshot to tar file
# Source: https://github.com/opencv/openvino_training_extensions/blob/develop/pytorch_toolkit/nncf/examples/common/utils.py#L86
import tarfile
from pathlib import Path
def create_code_snapshot(root, dst_path, extensions=(".py", ".json", ".cpp", ".cu")):
"""Creates tarball with the source code"""
with tarfile.open(str(dst_path), "w:gz") as tar:
for path in Path(root).rglob("*"):
@pbamotra
pbamotra / iclr-2020-favorites-pbamotra.txt
Last active April 26, 2020 03:15
ICLR 2020 Favorites - WIP
Calendar: https://iclr.cc/virtual/calendar.html#tab-calendar
Paper search: https://iclr.cc/virtual/papers.html?filter=keywords
Papers:
1. Title:
Tree-Structured Attention with Hierarchical Accumulation
Authority:
Richard Socher
Url:
https://iclr.cc/virtual/poster_HJxK5pEYvr.html
@pbamotra
pbamotra / amznlistexport.py
Created April 28, 2020 01:18
amazon-books-wishlist-to-pandas
import datetime
import glob
from lxml import etree
import pandas as pd
def get_books(file):
doc = etree.HTMLParser()
tree = etree.parse(file, parser=doc)

Keybase proof

I hereby claim:

  • I am pbamotra on github.
  • I am benzene (https://keybase.io/benzene) on keybase.
  • I have a public key ASCnWFSySbSBalyy4SCcjIzFTkb2gGmffCtnRewv0sLT2wo

To claim this, I am signing this object:

@pbamotra
pbamotra / call-shortlist.py
Created April 12, 2021 01:03
Filter good and affordable calls
# Execute this in a Jupyter notebook
import os
import json
import base64
import pandas as pd
from pprint import pprint
# Import USD 10B+, 1MM vol+, 25+ P/E, Buy/Strong Buy rated
buy_rated_tradingview = pd.read_csv('~/Downloads/america_2021-04-11.csv')
@pbamotra
pbamotra / CascadeTabNet2Onnx.sh
Created April 25, 2021 01:35
Cascade Tabnet to Onnx
!pip install cython==0.28.5
!pip install mmdet==2.10.0 requests
!pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html
!pip install mmcv-full==1.2.7+torch1.7.0+cu110 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
!pip install onnx onnxruntime onnxruntime-gpu onnxoptimizer
!git clone --branch v2.10.0 https://github.com/open-mmlab/mmdetection.git
# Download conf and weights from
# https://github.com/iiLaurens/CascadeTabNet/blob/mmdet2x/Demo/Cascade_Tabnet_mmdet_v2_cpu_only_demo.ipynb
@pbamotra
pbamotra / bankrate.sh
Created March 22, 2023 00:20
cmdline bankrate mortgages
# Assumes you've awk, jq, curl installed
calc() { awk "BEGIN{print $*}"; }
export PROPERTY_VALUE=1000000
export LOAN_AMOUNT=`calc $PROPERTY_VALUE*0.8`
export PROPERTY_ZIP=94107
alias bankrate="curl 'https://mortgage-api.bankrate.com/rates/v4/?loanType=purchase&propertyValue=$PROPERTY_VALUE&propertyType=SingleFamily&propertyUse=PrimaryResidence&cashOutAmount=0&zipCode=$PROPERTY_ZIP&loanAmount=$LOAN_AMOUNT&creditScore=770&debtToIncomeRatio=0&pointsRange=Zero&productFamilies\[\]=conventional&loanTerms\[\]=30yr&loanTerms\[\]=7-1arm&loanTerms\[\]=7-6arm&loanTerms\[\]=10-1arm&loanTerms\[\]=10-6arm&defaultSearch=true&pid=br3&veteranStatus=NoMilitaryService&hadPriorVaLoan=false&hasVaDisabilities=false&firstTimeHomeBuyer=false&displayTargets\[\]=mobileRateTable&displayTargets\[\]=featuredRateTable&deviceTypes\[\]=mobile&e2eTestEnabled=false&clientId=MortgageRateTable&includeSponsored=true&includeEditorial=true' -H 'authority: mortgage-api.bankrate.com' -H 'accept: application/json, text/plain, */*' -H 'accept

[Design Doc] Your Project Name

Design docs are a way to propose future work and get detailed technical feedback.

Problem Context

Brief description of what the problem or opportunity is. Give an overview of the domain and pain points. What is the current solution? Give some details about what its shortcomings are.

Proposed Solution