Skip to content

Instantly share code, notes, and snippets.

View ceshine's full-sized avatar

CeShine Lee ceshine

View GitHub Profile
@ceshine
ceshine / avazu_ftrl.go
Last active February 4, 2021 19:35
Kaggle Avazu Challenge: FTRL-Proximal with L1 & L2 implemented in Go (single-threaded)
// Based on tinrtgu's Python script here:
// https://www.kaggle.com/c/avazu-ctr-prediction/forums/t/10927/beat-the-benchmark-with-less-than-1mb-of-memory
package main
import (
"encoding/csv"
"os"
"strconv"
"hash/fnv"
"math"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / bit_models.py
Created July 6, 2020 12:43
(Customized) Big Transfer (BiT) Models from google-research/big_transfer
# Adapted from: https://github.com/google-research/big_transfer/blob/6c83d6459e009fa89d84c1e904611e9b162e6eff/bit_pytorch/models.py
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@ceshine
ceshine / async_test.jl
Created May 24, 2020 12:11
A simple script to demonstrate the @async macro in Julia
begin
tmp1 = @async sleep(20)
tmp2 = @async sleep(30)
@time fetch(tmp1)
@time fetch(tmp2)
end
@ceshine
ceshine / ts_handler.py
Created May 4, 2020 10:08
A custom handler example for TensorServe (image classification)
import io
import os
import logging
import torch
import torch.nn.functional as F
import numpy as np
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
@ceshine
ceshine / detector.py
Last active April 22, 2020 05:57
A Simple CJK Language Detector
import re
def cjk_detect(texts):
# korean
if re.search("[\uac00-\ud7a3]", texts):
return "ko"
# japanese
if re.search("[\u3040-\u30ff]", texts):
return "ja"
@ceshine
ceshine / run_tf_glue.ipynb
Last active February 23, 2020 18:50
Train huggingface/transformers BERT model on Colab CPU with TF 2.1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / lr_scheduler_example.ipynb
Created December 30, 2019 09:15
LR Scheduler which works with TF 2.x distributed mode
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / spacy_sentencizer.ipynb
Created August 14, 2019 04:46
Customizing Spacy's Statistical Sentence Segmenter with Custom Rules
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / python_in_visual_studio_code.md
Last active August 5, 2019 09:30
How To Develop Python Programs in Visual Studio Code

How To Develop Python Programs in Visual Studio Code

Prerequisites

You have to already have these in your system: