Skip to content

Instantly share code, notes, and snippets.

View ModMorph's full-sized avatar

Dan ModMorph

  • ModMorph.AI
  • Visiotemporal Wordspace
  • X @ModMorph
View GitHub Profile
def slerp(t, v0, v1, DOT_THRESHOLD=0.9995):
'''
Spherical linear interpolation
Args:
t (float/np.ndarray): Float value between 0.0 and 1.0
v0 (np.ndarray): Starting vector
v1 (np.ndarray): Final vector
DOT_THRESHOLD (float): Threshold for considering the two vectors as
colineal. Not recommended to alter this.
Returns:
@afiaka87
afiaka87 / train_dalle_pytorch.ipynb
Last active September 14, 2021 01:46
train_dalle_pytorch.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@voodoohop
voodoohop / render_training_video.py
Last active May 7, 2021 19:38
Creates a video from sequential training progress images. Skips more and more frames as iterations increase.
from glob import glob
# Creates a video from a folder containing images of training progress
# Allows sampling the image less often as iterations increase
# (Requires images be sortable by filename for now. Could use modification date too)
def render_video(output_path="/content/taming-transformers/output.mp4", src_path="/content/taming-transformers/", file_glob="*.png", step_increase_every=100):
tmp_path = "/tmp/latentvisions_tmp"
files = glob(src_path+file_glob)
files.sort()
import sys
def get_size(obj, seen=None):
"""Recursively finds size of objects"""
size = sys.getsizeof(obj)
if seen is None:
seen = set()
obj_id = id(obj)
if obj_id in seen:
return 0