Skip to content

Instantly share code, notes, and snippets.

CeShine Lee ceshine

View GitHub Profile
@ceshine
ceshine / bit_models.py
Created Jul 6, 2020
(Customized) Big Transfer (BiT) Models from google-research/big_transfer
View bit_models.py
# 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
A simple script to demonstrate the @async macro in Julia
View async_test.jl
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
A custom handler example for TensorServe (image classification)
View ts_handler.py
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 / profiling.ipynb
Created Apr 24, 2020
Tensorflow Profiler with Custom Training Loop
View profiling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / run_tf_glue.ipynb
Last active Feb 23, 2020
Train huggingface/transformers BERT model on Colab CPU with TF 2.1
View run_tf_glue.ipynb
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 Dec 30, 2019
LR Scheduler which works with TF 2.x distributed mode
View lr_scheduler_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / run_tf_glue.ipynb
Created Dec 26, 2019
Train huggingface/transformers BERT model on Cloud CPU with TF 2.1 (nightly build)
View run_tf_glue.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pytorch-memory-profiling.ipynb
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 Aug 14, 2019
Customizing Spacy's Statistical Sentence Segmenter with Custom Rules
View spacy_sentencizer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / convert.py
Created Jul 17, 2019
A simple script to convert markdown image specification to hugo shortcode (result is automatically copied to clipboard)
View convert.py
from subprocess import Popen, PIPE
def image_markdown_conversion():
try:
while True:
text = input("Input:").strip()
brackets, split_point = 1, 0
description = ""
assert len(text) > 5, "wrong format!"
You can’t perform that action at this time.