Skip to content

Instantly share code, notes, and snippets.

View KDercksen's full-sized avatar

Koen Dercksen KDercksen

View GitHub Profile
@KDercksen
KDercksen / plot_trainer_log_history.py
Created September 7, 2023 12:09
Plot HF log history from trainer_state.json
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
import matplotlib.pyplot as plt
from collections import defaultdict
from utils import read_json
import argparse
exclude_keys = [
@KDercksen
KDercksen / filter_explanations_dash.py
Created July 3, 2023 13:31
Embedding similarity filtering of entity descriptions
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from base64 import b64decode
import dash_bootstrap_components as dbc
import numpy as np
from dash import Dash, Input, Output, State, callback, dash_table, dcc, html
from dash.exceptions import PreventUpdate
@KDercksen
KDercksen / summary_evaluation.py
Created June 27, 2023 13:36
Summary evaluation app using Gradio
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import gradio as gr
def read_jsonl(fname):
with open(fname) as f:
@KDercksen
KDercksen / Data Augmentation - Mixing Images with Gaussian Density Estimation.ipynb
Created April 19, 2019 17:19
Example of using random data with gaussian density estimation to mix two images for data augmentation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KDercksen
KDercksen / unet.py
Created March 11, 2018 21:52
U-Net original architecture implementation for Keras
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from keras.layers import (concatenate,
Conv2D,
Cropping2D,
Input,
MaxPooling2D,
UpSampling2D,
)
@KDercksen
KDercksen / wpcycle.sh
Created March 2, 2018 22:44
Wallpaper cycler
#!/usr/bin/env bash
set -e
WPDIR = $1
WAITTIME = $2
while true; do
feh --bg-scale --no-xinerama $(find "$WPDIR" -type f | shuf -n1)
sleep $WAITTIME
done
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
word = sys.argv[1]
scores = [ord(letter) - 96 for letter in word.lower() if letter.isalpha()]
print(f'{word} = {" + ".join(map(str, scores))} = {sum(scores)}%')
@KDercksen
KDercksen / autoexec.cfg
Created May 6, 2016 12:29
CS:GO config file
bind "kp_ins" "buy ak47; buy m4a1;"
bind "kp_del" "buy deagle;"
bind "kp_enter" "buy vesthelm;"
bind "kp_plus" "buy vest;"
bind "kp_end" "buy flashbang"
bind "kp_downarrow" "buy smokegrenade;"
bind "kp_pgdn" "buy molotov; buy incgrenade;"
bind "kp_leftarrow" "buy hegrenade;"
bind "kp_5" "buy defuser;"
bind "kp_rightarrow" "buy awp;"