This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any | |
from rich.console import Console | |
from rich.theme import Theme | |
from rich.text import Text | |
custom_theme = Theme({ | |
"key": "yellow", | |
"type": "cyan", | |
"value": "green", | |
"tree": "bright_black", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (factory) { | |
typeof define === 'function' && define.amd ? define(factory) : | |
factory(); | |
}((function () { 'use strict'; | |
// Copyright 2018 The Distill Template Authors | |
// | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"url": "https://calendar.google.com/calendar/ical/a0743f85a7e10fa90a0dabedbc0742ffd67995ae7ad5a8d90ed0ed35efacdf5e%40group.calendar.google.com/public/basic.ics", | |
"title": "ICLP 2023 Schedule", | |
"date": "2023-07-09", | |
"starting_hour": "8", | |
"ending_hour": "20", | |
"hour_division": "2", | |
"target": "_self", | |
"start_of_week": "su", | |
"timezone": "Europe/London", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Color definitions to override the quiver web color scheme with matplotlib colors defined as tex macros | |
// This allows easy creation of stylistically consistent Tikz diagrams with relative ease |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EDIT 10/04/2022 - This version was provided by @jayelm who fixed some bugs and made the function much more robust | |
import os | |
import subprocess | |
import time | |
def assign_free_gpus(threshold_vram_usage=1500, max_gpus=2, wait=False, sleep_time=10): | |
""" | |
Assigns free gpus to the current process via the CUDA_AVAILABLE_DEVICES env variable | |
This function should be called after all imports, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
import random | |
import tensorflow as tf | |
# from tfdeterminism import patch - only in older versions (<2?) of Tensorflow | |
# import torch | |
def seed(seed=42): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally taken from Xander Steenbrugge | |
# cv2: | |
height, width, _ = img.shape | |
img_resized = cv2.resize(img, (new_width, new_height)) | |
img_pixel_values = img[top:down, left:right, :] | |
# PIL | |
width, height = img.size | |
img_resized = img.resize((new_width, new_height)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Light Mode | |
{ | |
"customColorSchemes": [[ | |
{"fill": "#2282bc", "stroke": "none"}, // blue | |
{"fill": "#17c6d5", "stroke": "none"}, // cyan | |
{"fill": "#c4c526", "stroke": "none"}, // yellow | |
{"fill": "#e782c9", "stroke": "none"}, // pink | |
{"fill": "#9e72c5", "stroke": "none"}, // purple | |
{"fill": "#db2c2d", "stroke": "none"}, // red | |
{"fill": "#32aa32", "stroke": "none"}, // green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt |
NewerOlder