Skip to content

Instantly share code, notes, and snippets.

View ceshine's full-sized avatar

CeShine Lee ceshine

View GitHub Profile
@ceshine
ceshine / streamlit.py
Created March 14, 2021 06:41
Streamlit Script that Cache the loading of a FAISS index (live at https://news-search.veritable.pw)
import os
import sqlite3
import datetime
from typing import List
import faiss
import numpy as np
import pandas as pd
import joblib
import requests
@ceshine
ceshine / demo.py
Created February 19, 2021 05:31
Demo of the @patch_to decorator from fastcore
from fastcore.basics import patch_to
class Demo:
val = 10
def __init__(self, val):
self.val = val
# ====================
# The default mode
@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 / profiling.ipynb
Created April 24, 2020 06:31
Tensorflow Profiler with Custom Training Loop
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 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 / run_tf_glue.ipynb
Created December 26, 2019 06:55
Train huggingface/transformers BERT model on Cloud CPU with TF 2.1 (nightly build)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.