Skip to content

Instantly share code, notes, and snippets.

View wolframalpha's full-sized avatar
💭
knobs!

Devi Prasad Khatua wolframalpha

💭
knobs!
View GitHub Profile
@Birch-san
Birch-san / CUDA-12-1-1-pytorch.md
Last active April 28, 2024 10:22
Installing CUDA 12.1.1 + PyTorch nightly + Python 3.10 on Ubuntu 22.10

Installing CUDA 12.1.1 + PyTorch nightly + Python 3.10 on Ubuntu 22.10

Should you keep your NVIDIA driver?

CUDA 12.1.1 toolkit is gonna offer to install Nvidia driver 530 for us. It's from New Feature branch. It's likely to be newer than the default Nvidia driver you would've installed via apt-get (apt would prefer to give you 525, i.e. Production Branch).

If you're confident that you already have a new enough Nvidia driver for CUDA 12.1.1, and you'd like to keep your driver: feel free to skip this "uninstall driver" step.

But if you're not sure, or you know your driver is too old: let's uninstall it. CUDA will install a new driver for us later.

@wolframalpha
wolframalpha / evaluator_utils.py
Last active December 14, 2018 05:57
INCSQL -> SEQ2SEQ | Natural Language to SQL | WikiSQL
# from sklearn.metrics import f1_score, accuracy_score
import numpy as np
from collections import defaultdict
def get_metrics_cm_for_one_index(cm, index):
n_samples = cm.ravel().sum()
total_obs = cm[index].sum()
tp = cm[index, index]
fp = cm[:, index].sum() - cm[index, index]
@cbaziotis
cbaziotis / SelfAttention.py
Created April 21, 2018 17:31
SelfAttention implementation in PyTorch
class SelfAttention(nn.Module):
def __init__(self, attention_size, batch_first=False, non_linearity="tanh"):
super(SelfAttention, self).__init__()
self.batch_first = batch_first
self.attention_weights = Parameter(torch.FloatTensor(attention_size))
self.softmax = nn.Softmax(dim=-1)
if non_linearity == "relu":
self.non_linearity = nn.ReLU()
@wolframalpha
wolframalpha / ExperienceTagger.py
Last active March 24, 2017 07:00
Please extract the NP using this !
# coding: utf-8
import pickle
import re
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
import numpy as np
import pandas as pd
from nltk.tag import pos_tag, pos_tag_sents
from nltk.tokenize import word_tokenize
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
@jayswan
jayswan / gist:a8d9920ef74516a02fe1
Last active March 11, 2022 15:33
Elasticsearch Python bulk index API example
>>> import itertools
>>> import string
>>> from elasticsearch import Elasticsearch,helpers
es = Elasticsearch()
>>> # k is a generator expression that produces
... # a series of dictionaries containing test data.
... # The test data are just letter permutations
... # created with itertools.permutations.
... #
... # We then reference k as the iterator that's
@drorata
drorata / gist:146ce50807d16fd4a6aa
Last active February 27, 2024 10:15
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})