Skip to content

Instantly share code, notes, and snippets.

Avatar

Cheng Guo entron

  • Allianz
View GitHub Profile
@entron
entron / cnn_dummy_bench.ipynb
Last active Jun 13, 2020
simple gpu benchmark code with pytorch for common CNN netoworks
View cnn_dummy_bench.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / cifar10_bench.ipynb
Last active Jun 13, 2020
simple gpu benchmark with pytorch
View cifar10_bench.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / plot_dingxiang_data.ipynb
Last active Feb 11, 2020
Plotting data of 2019-nCoV outbreak. Data source: https://github.com/BlankerL/DXY-2019-nCoV-Data
View plot_dingxiang_data.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / test_pytorch.py
Created Aug 14, 2017
Test pytorch linear algebra speed
View test_pytorch.py
import torch
import time
# --- Test 1
N = 10
n = 1000
A = torch.randn(n, n)
B = torch.randn(n, n)
@entron
entron / test_numpy.py
Last active Jun 7, 2020
Test numpy installation.
View test_numpy.py
import numpy as np
import numpy.random as npr
import time
# --- Test 1
N = 100
n = 2000
A = npr.randn(n, n)
B = npr.randn(n, n)
@entron
entron / sqlite_online_backup.py
Created Aug 13, 2016
Online backup sqlite db with python
View sqlite_online_backup.py
# Online backup a sqlite3 DB.
# python3 sqlite_online_backup.py db_to_backup.sqlite backup_db.sqlite
import sqlite3
import sqlitebck
import sys
fname_to_backup = sys.argv[1]
fname_backup = sys.argv[2]
@entron
entron / gist:cfb5a560f1372acb8bf7
Created Feb 15, 2016 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest
View gist:cfb5a560f1372acb8bf7

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

@entron
entron / imdb_cnn_kim_small_embedding.py
Last active Jan 20, 2020
Keras implementation of Kim's paper "Convolutional Neural Networks for Sentence Classification" with a very small embedding size. The test accuracy is 0.853.
View imdb_cnn_kim_small_embedding.py
'''This scripts implements Kim's paper "Convolutional Neural Networks for Sentence Classification"
with a very small embedding size (20) than the commonly used values (100 - 300) as it gives better
result with much less parameters.
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python imdb_cnn.py
Get to 0.853 test accuracy after 5 epochs. 13s/epoch on Nvidia GTX980 GPU.
'''
from __future__ import print_function
@entron
entron / nltk-intro.py
Created Jan 14, 2016 — forked from alexbowe/nltk-intro.py
Demonstration of extracting key phrases with NLTK in Python
View nltk-intro.py
import nltk
text = """The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital
computer or the gears of a cycle transmission as he does at the top of a mountain
or in the petals of a flower. To think otherwise is to demean the Buddha...which is
to demean oneself."""
# Used when tokenizing words
sentence_re = r'''(?x) # set flag to allow verbose regexps
([A-Z])(\.[A-Z])+\.? # abbreviations, e.g. U.S.A.
@entron
entron / understand_dnn_conv.ipynb
Created Sep 18, 2015
Show different convolution results between numpy and theano
View understand_dnn_conv.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.