Skip to content

Instantly share code, notes, and snippets.

@windbg
windbg / use_tf_serving_with_bert4keras.txt
Created August 23, 2020 02:54 — forked from liprais/use_tf_serving_with_bert4keras.txt
让bert4keras使用Tensorflow serving调用模型
0.
基于tf2.0
1.
把已有的模型导出成pb格式
保存的时候的INFO:tensorflow:Unsupported signature for serialization貌似不用管
python code:
import os
os.environ['TF_KERAS'] = '1'
import numpy as np
@windbg
windbg / min-char-rnn.py
Created January 9, 2020 05:10 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@windbg
windbg / download_glue_data.py
Created July 21, 2019 03:02 — 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
@windbg
windbg / README.md
Created July 11, 2017 08:06 — forked from e7d/README.md
[Debian] Setup a Squid anonymous proxy
@windbg
windbg / dnsmasq-gfwlist.py
Created April 24, 2017 06:36 — forked from lanceliao/dnsmasq-gfwlist.py
将gfwlist转换成带ipset的dnsmasq规则,适用于OpenWrt智能上网
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@windbg
windbg / ssh_agent_start.fish
Created April 24, 2017 06:01 — forked from schaary/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
setenv SSH_ENV $HOME/.ssh/environment
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
if [ $status -eq 0 ]
test_identities
end
else
if [ -f $SSH_ENV ]
. $SSH_ENV > /dev/null
@windbg
windbg / zerologger.py
Created March 4, 2012 03:01 — forked from gwik/zerologger.py
Python logger ZeroMQ, Gevent, CouchDB
# encoding: utf-8
"""
A python logging Handler that use ZeroMQ (ØMQ).
+------+ +------+ +-------+
| app1 | | app2 | | app X |
+------+ +------+ +-------+
| PUSH | PUSH | PUSH
| | |
@windbg
windbg / yahoo.py
Created February 11, 2012 01:53
example of providers/yahoo
#!/usr/bin/env python
#coding=utf-8
import datetime
import os
import sys
from tornado.curl_httpclient import CurlAsyncHTTPClient as AsyncHTTPClient
from tornado import ioloop
ROOT_PATH = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')