Skip to content

Instantly share code, notes, and snippets.

View lolipopshock's full-sized avatar
🎯
Focusing

Shannon Shen lolipopshock

🎯
Focusing
View GitHub Profile
@lolipopshock
lolipopshock / download_hf.py
Last active July 25, 2024 01:56
Efficiently downloads HuggingFace models by circumventing the `.git` directory. It can speed up the download process by approximately 2x by avoiding downloading the `.git` folder, which contains a copy of the models (thanks to git-lfs). This script can be especially beneficial for large models (e.g., Meta-Llama-3.1-405B).
"""
Efficiently downloads HuggingFace models by circumventing the `.git` directory.
Speeds up the download process by approximately 2x by avoiding downloading the
`.git` folder, which contains a copy of the models (thanks to git-lfs). This script
can be especially beneficial for large models (e.g., Meta-Llama-3.1-405B).
Usage:
python download_hf.py \
<hf_repo_id> <destination_folder> \
@lolipopshock
lolipopshock / cs-sop.js
Last active June 12, 2023 22:54
Allow PDF embed
var scriptProperties = PropertiesService.getScriptProperties();
const NOTION_API_TOKEN = scriptProperties.getProperty('NOTION_TOKEN');
const NOTION_PAGE_ID = scriptProperties.getProperty('NOTION_PAGE_URL');
function main(e) {
var itemResponses = e.response.getItemResponses();
var rawResponseData = {};
for (var j = 0; j < itemResponses.length; j++) {
@lolipopshock
lolipopshock / create_plist.py
Created December 30, 2020 19:45
A Python script for creating plist files in macOS systems interactively.
import os
import plistlib
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--META_NAME", type=str, default="programName")
parser.add_argument("--LOG_PATH", type=str, default="/var/log/programName")
@lolipopshock
lolipopshock / download_cvf_paper_info.py
Last active July 12, 2020 17:18
[CV Paper Info Table] Download Paper Information from thecvf Website
"""Download the paper information from thecvf website and save them into csv files
Examples:
>> python download_cvf_paper.py --save_path 'save'
Saved Files:
* cvf_all.csv
both paper and workshop papers listed on the thecvf website
* cvf_papers.csv
@lolipopshock
lolipopshock / recombine_img.py
Created October 17, 2019 20:03
This code extract the individual characters from the input image and output an image with combined character regions
import cv2
import matplotlib.pyplot as plt
from skimage import measure
####
# Ref to https://github.com/Vasistareddy/python-rlsa/blob/master/rlsa.py
import numpy as np
def iteration(image: np.ndarray, value: int) -> np.ndarray:
"""