Skip to content

Instantly share code, notes, and snippets.


binTang rabintang

  • Tencent, Shenzhen
  • Shenzhen, China
View GitHub Profile
rabintang /
Last active Nov 10, 2017
torchtext dataset example
from torchtext import data
class DatasetDemo(data.Dataset):
def __init__(self, fields, path=None, examples=None, **kwargs):
if examples is None:
examples = []
for line in file(path):
parts = line.split("\t")
target = parts[0]
rabintang /
Created Jul 24, 2017 — forked from batzner/
Small python script to rename variables in a TensorFlow checkpoint
import sys, getopt
import tensorflow as tf
usage_str = 'python --checkpoint_dir=path/to/dir/ ' \
'--replace_from=substr --replace_to=substr --add_prefix=abc --dry_run'
def rename(checkpoint_dir, replace_from, replace_to, add_prefix, dry_run):
checkpoint = tf.train.get_checkpoint_state(checkpoint_dir)
# (by Graham Neubig)
# This script trains conditional random fields (CRFs)
# stdin: A corpus of WORD_POS WORD_POS WORD_POS sentences
# stdout: Feature vectors for emission and transition properties
from collections import defaultdict
from math import log, exp
import sys
rabintang / GoogleSpellingAPI
Last active Dec 29, 2015
View GoogleSpellingAPI
# -*- coding: utf-8 -*-
import time
import os
import sys
import urllib2,urllib
import HTMLParser
import xml.dom.minidom
import xml.etree.ElementTree as ET
rabintang / gist:5975472
Created Jul 11, 2013
View gist:5975472
* 功能:发送自定义电子邮件,可以用于在系统发送自定义系统邮件。
using System;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
namespace XFish.Utils
rabintang /
Last active Dec 18, 2015
#-*-!/usr/bin/env python-*-
from PIL import Image
import os
import sys
import fnmatch
import logging
class ThumbnailGenerator:
rabintang / Atopk SQL File
Created Jun 20, 2013
zen cart的Atopk模板的空数据库文件
View Atopk SQL File
-- phpMyAdmin SQL Dump
-- version
-- 主机: localhost
-- 生成日期: 2013 年 06 月 18 日 23:36
-- 服务器版本: 5.5.29
-- PHP 版本: 5.4.6-1ubuntu1.1
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import urllib
import urllib2
import cookielib
import base64
import re
import json