Skip to content

Instantly share code, notes, and snippets.

Avatar

CeShine Lee ceshine

View GitHub Profile
@ceshine
ceshine / streamlit.py
Created Mar 14, 2021
Streamlit Script that Cache the loading of a FAISS index (live at https://news-search.veritable.pw)
View streamlit.py
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 Feb 19, 2021
Demo of the @patch_to decorator from fastcore
View demo.py
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 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.