Skip to content

Instantly share code, notes, and snippets.

View csarron's full-sized avatar
🎯
Focusing

Qingqing Cao csarron

🎯
Focusing
View GitHub Profile
@csarron
csarron / download_glue_data.py
Created December 2, 2019 01:17 — forked from W4ngatang/download_glue_data.py
Script for downloading data of the GLUE benchmark (gluebenchmark.com)
''' Script for downloading all GLUE data.
Note: for legal reasons, we are unable to host MRPC.
You can either use the version hosted by the SentEval team, which is already tokenized,
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually.
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example).
You should then rename and place specific files in a folder (see below for an example).
mkdir MRPC
cabextract MSRParaphraseCorpus.msi -d MRPC
import itertools
def grouper(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks"""
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return itertools.zip_longest(*args, fillvalue=fillvalue)
a=itertools.chain.from_iterable(itertools.repeat(['a', 'b', 'c'], 4))
b=itertools.chain.from_iterable(itertools.repeat(['d', 'e', 'f', 'g'], 3))
RCol='\e[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m';
Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m';
Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m'; On_Pur='\e[45m'; On_IPur='\e[0;105m';
C
use feed dict instead of directly pass tensor
embeddings = self.session.run(self.encoding_tensor, feed_dict={
self.input_placeholder: need_compute
})
# si_emb = self.session.run(self.embed([s]))[0]
@csarron
csarron / pylucence_install.md
Last active March 27, 2021 02:51
pylucence build and install on macOS and Ubuntu

install prebuilt eggs:

Ubuntu: may need to export libjvm.so ls -l /etc/alternatives/java will output something like: /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java then do: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/ export JCC_JDK=/usr/lib/jvm/java-8-openjdk-amd64

for macOS: easy_install JCC-3.2-py3.6-macosx-10.13-x86_64.egg lucene-7.5.0-py3.6-macosx-10.13-x86_64.egg

@csarron
csarron / squad_top20_single_model_20180828.csv
Created August 28, 2018 21:10
11 /13 use rnns, 2 use attn, 7 unkown
Rank (duplicates merged) Model Technique Paper Notes
1 MARS BiLSTM + attn https://posts.careerengine.us/p/5ad8637755ba6b136fc793ad (slides in English, notes in Chinese)
2 QANet attn https://arxiv.org/abs/1804.09541
3 Reinforced Mnemonic Reader BiLSTM https://arxiv.org/abs/1705.02798
4 r-net BiGRU https://www.microsoft.com/en-us/research/wp-content/uploads/2017/05/r-net.pdf
5 SLQA+ BiLSTM http://www.aclweb.org/anthology/P18-1158
6 BiDAF + Self Attention + ELMo + A2D BiGRU https://arxiv.org/abs/1710.10723
7 Hybrid AoA Reader BiGRU https://arxiv.org/abs/1607.04423
8 MAMCN+ BiGRU http://www.aclweb.org/anthology/W18-2603
9 MDReader unknown
@csarron
csarron / profile.ps1
Last active July 12, 2018 19:01
handy git alias for powershell
# code $profile.CurrentUserAllHosts
Import-Module posh-git
function ga {
git add $args
}
function gaa {
git add --all
}
function gb {
git branch
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
if (!(Get-Command choco -errorAction SilentlyContinue))
{
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Confirm:$false
"choco not exists or not installed, begin installing chocolatey..."
$script = New-Object Net.WebClient
$script | Get-Member
$script.DownloadString("https://chocolatey.org/install.ps1")
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

MobileNet Inference Time

Movidius NCS Accelerator

Using NCSDK 1.12.00, lastest as of April 2018

Version Average Inference Time
@csarron
csarron / scrcpy_shortcut.md
Created April 20, 2018 02:08
Scrcpy Shortcuts

Scrcpy Shortcuts

Action Shortcut
switch fullscreen mode Ctrl+f
resize window to 1:1 (pixel-perfect) Ctrl+g
resize window to remove black borders Ctrl+x | Double-click¹
click on HOME Ctrl+h | Middle-click
click on BACK Ctrl+b | Right-click²
click on APP_SWITCH Ctrl+m