Skip to content

Instantly share code, notes, and snippets.

View lumpidu's full-sized avatar

Daniel lumpidu

View GitHub Profile
@lumpidu
lumpidu / gcc 5 on ubuntu 14.04
Created April 29, 2016 14:19 — forked from beci/gcc 5 on ubuntu 14.04
use gcc 5.x on ubuntu 14.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
@lumpidu
lumpidu / android_ares_config.patch
Created February 25, 2019 11:55
Build gRPC for Android
46c46
< #define GETSERVBYPORT_R_ARGS 6
---
> #define GETSERVBYPORT_R_ARGS
131c131
< #define HAVE_GETSERVBYPORT_R
---
> /* #undef HAVE_GETSERVBYPORT_R */
46c46
< #define GETSERVBYPORT_R_ARGS 6
@lumpidu
lumpidu / gist:f9d068146564f9aea94e42ed2c04f68d
Created May 4, 2023 17:40
Create embeddings from given LM
import torch
import transformers
import argparse
from pytictoc import TicToc
def load_model_and_tokenizer(model_name):
the_tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
tokenizer_model = transformers.AutoModel.from_pretrained(model_name)
return tokenizer_model, the_tokenizer
import argparse
import hashlib
import os
import urllib
import warnings
from collections import OrderedDict
import torch
from torch import nn
from tqdm import tqdm