Skip to content

Instantly share code, notes, and snippets.

View TinfoilHat0's full-sized avatar
👽
I want to believe

Mustafa Safa Ozdayi TinfoilHat0

👽
I want to believe
View GitHub Profile
@stefanonardo
stefanonardo / early_stopping.py
Last active February 28, 2024 19:21
Early Stopping PyTorch
# MIT License
#
# Copyright (c) 2018 Stefano Nardo https://gist.github.com/stefanonardo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@krishvishal
krishvishal / plot_kernels.py
Last active October 22, 2022 18:27
Visualize weights in pytorch
from model import Net
from trainer import Trainer
import torch
from torch import nn
from matplotlib import pyplot as plt
model = Net()
ckpt = torch.load('path_to_checkpoint')
model.load_state_dict(ckpt['state_dict'])
filter = model.conv1.weight.data.numpy()
@jdp
jdp / countmin.py
Created April 7, 2013 15:49
example count-min sketch implementation
import random
class CountMinSketch(object):
def __init__(self, w, d, p):
self.w = w
self.d = d
self.p = p
self.C = [[0] * self.w for _ in range(self.d)]
self.a = [random.randint(1, self.p) for _ in range(self.d)]