Skip to content

Instantly share code, notes, and snippets.

Wu Yi typhoonzero

  • Beijing
Block or report user

Report or block typhoonzero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View imdb_to_database.py
import tensorflow as tf
from tensorflow import keras
import numpy as np
import mysql.connector
db_conn = None
def get_db_connect(database="imdb"):
global db_conn
if not db_conn:
View tf2.0_keras_lstm_text_classification.py
import tensorflow as tf
import numpy as np
class LSTMClassifier(tf.keras.Model):
def __init__(self, feature_columns, units=32, hidden_layer=32, n_classes=2):
"""LSTMClassifier
:param feature_columns: feature columns.
:type feature_columns: list[tf.feature_column].
:param hidden_units: number of hidden units.
:type hidden_units: list[int].
View preprocess_imdb.py
# -*- coding: utf-8 -*-
# encoding=utf-8
# REQUIREMENTS:
# pip install mysql-connector
import sys, os
import codecs
import mysql.connector
def prepare_tables():
View test_pingcap_parser.go
package main
import (
"fmt"
"regexp"
"strings"
"github.com/pingcap/parser"
_ "github.com/pingcap/tidb/types/parser_driver" // As required by https://github.com/pingcap/parser/blob/master/parser_example_test.go#L19
)
@typhoonzero
typhoonzero / preprocess_toutiao.py
Created May 20, 2019
preprocess toutiao dataset in mysql
View preprocess_toutiao.py
# -*- coding: utf-8 -*-
# encoding=utf-8
# REQUIREMENTS:
# pip install jieba mysql-connector
# Download the dataset from https://github.com/fate233/toutiao-text-classfication-dataset
import sys
import codecs
View test_threadpool_perf.cc
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
#include <math.h>
#include <time.h>
#include "ThreadPool.h"
#include "ctpl.h"
View h2dtest.sh
#########################################################################
# File Name: h2dtest.sh
# Author: lychee
# Email: lizhi14@baidu.com
# goto /usr/local/cuda/samples/1_Utilities/bandwidthTest and run make
#########################################################################
#!/bin/bash
# Host to GPU
echo "#### Host to GPU ####"
for i in `seq 1 30`; do
View fluid_benchmark_log_to_vdl_data.py
from __future__ import print_function
import random
from visualdl import LogWriter
logdir = "resnet50_v100"
def parse_logdata(logfile):
loss_ret = {}
View sync_img_to_bce.py
#!/bin/bash
image="paddlepaddle/paddle"
tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'`
if [ -n "$2" ]
then
tags=` echo "${tags}" | grep "$2" `
fi
@typhoonzero
typhoonzero / check_ctest_hung_test.py
Created Jun 12, 2018
get which ctest case hungs from the ctest log
View check_ctest_hung_test.py
import sys
import re
def escape(input):
o = input.replace("\n", "")
o = o.replace("\r", "")
return o
def main():
logfile = sys.argv[1]
You can’t perform that action at this time.