Skip to content

Instantly share code, notes, and snippets.

View theeluwin's full-sized avatar
🍄
curseholic

Jamie J. Seol theeluwin

🍄
curseholic
View GitHub Profile
@theeluwin
theeluwin / git_get_all.sh
Last active July 19, 2022 07:14
clone everything, everything
mkdir repo
cd repo
git clone --bare path/to/repo.git .git
git config --unset core.bare
git reset --hard
@theeluwin
theeluwin / well_documented_transformer.py
Last active January 18, 2022 19:36
Well-documented Transformer
import torch
import torch.nn as nn
from typing import Optional
from math import (
pi,
sqrt,
)
@theeluwin
theeluwin / calc_batch_rec_metrics_per_k.py
Last active December 13, 2021 13:12
HR, Recall, nDCG, AUROC @ k (recommendation evaluation metric)
import torch
from typing import (
Any,
List,
Dict,
)
def calc_batch_rec_metrics_per_k(ranks: torch.LongTensor,
import os
from unicodedata import normalize
def walk_normalize(target_dir):
for root, dirs, files in os.walk(target_dir):
for name in files:
path = os.path.join(root, name)
if name == '.DS_Store':
@theeluwin
theeluwin / randaug.py
Created June 25, 2021 14:39
from @ihl7029
import random
import PIL
import PIL.ImageOps
import PIL.ImageEnhance
import PIL.ImageDraw
__all__ = (
'augment_bound',
@theeluwin
theeluwin / get_logger.py
Created July 20, 2020 14:14
맨날 쓰는 그 로거
def get_logger(name, log_dir, use_formatter=True):
# 함수를 처음 부르는 경우, static 변수를 추가
if not hasattr(get_logger, '_name2logger'):
get_logger._name2logger = {}
# 생성한적 없는 로거 객체의 경우, 초기화
if name not in get_logger._name2logger:
# 로그 파일 경로 설정
@theeluwin
theeluwin / gom_downloader.py
Created February 23, 2020 06:41
곰자막 다운로드 스크립트 (죄송해요 곰앤컴퍼니 여러분)
# -*- coding: utf -*-
import os
import time
import logging
import argparse
import requests
from bs4 import BeautifulSoup
@theeluwin
theeluwin / clean_debug_stuff.py
Created January 13, 2020 15:16
인생 백업할때 소스코드만 백업합시다.
# -*- coding: utf-8 -*-
import os
import shutil
TARGET_PATH = ""
bad_dirnames = (
'venv',
@theeluwin
theeluwin / keep_tree.py
Created January 8, 2020 01:22
gitignore 되어있는 폴더 트리를 구조만 유지하고 싶을때 .keep을 추가해서 처리
# -*- coding: utf-8 -*-
import os
import subprocess
def entry():
for root, _, _ in os.walk('.', topdown=True):
if root == '.':
continue
@theeluwin
theeluwin / pytorch-runtime.Dockerfile
Last active November 12, 2019 04:33
파이토치 런타임 환경용 도커
# syntax=docker/dockerfile:experimental
# from
FROM pytorch/pytorch:1.2-cuda10.0-cudnn7-runtime
LABEL maintainer="Jamie Seol <theeluwin@gmail.com>"
# apt init
ENV PYTHONUNBUFFERED=1
ENV LANG=C.UTF-8
ENV TZ=Asia/Seoul