Skip to content

Instantly share code, notes, and snippets.

View brayevalerien's full-sized avatar

Valérien brayevalerien

View GitHub Profile
@brayevalerien
brayevalerien / dataset_noiser.py
Created October 3, 2024 16:07
Small python script that adds some noise to all images in a dataset.
import os
import argparse
import numpy as np
from PIL import Image
from tqdm import tqdm
def add_gaussian_noise(image: Image, factor: float):
"""
Add a given amount of white guassian noise to an image.
@brayevalerien
brayevalerien / flux-dev-layers.txt
Created September 19, 2024 09:36 — forked from fofr/flux-dev-layers.txt
flux-dev-layers.txt
transformer.transformer_blocks.0.norm1.linear
transformer.transformer_blocks.0.norm1_context.linear
transformer.transformer_blocks.0.attn.to_q
transformer.transformer_blocks.0.attn.to_k
transformer.transformer_blocks.0.attn.to_v
transformer.transformer_blocks.0.attn.add_k_proj
transformer.transformer_blocks.0.attn.add_v_proj
transformer.transformer_blocks.0.attn.add_q_proj
transformer.transformer_blocks.0.attn.to_out.0
transformer.transformer_blocks.0.attn.to_add_out
@brayevalerien
brayevalerien / gist:21a86449b6536703dd378374559ee05f
Created May 6, 2024 00:24
Publication ready pyplot theme (thanks to @aeturrell)
plot_settings = {'ytick.labelsize': 16,
'xtick.labelsize': 16,
'font.size': 22,
'figure.figsize': (10, 5),
'axes.titlesize': 22,
'axes.labelsize': 18,
'lines.linewidth': 2,
'lines.markersize': 3,
'legend.fontsize': 11,
'mathtext.fontset': 'stix',
@brayevalerien
brayevalerien / markov_whatsapp_generator.py
Created June 21, 2023 22:07
Generate messages from a Whatsapp conversation using Markov Chains
import random
import numpy as np
class MarkovChainGenerator:
def __init__(self, order=1, length=10):
self.order = order
self.length = length
self.transitions = {}
def fit(self, X):
@brayevalerien
brayevalerien / print_list_and_dict.py
Last active May 2, 2024 15:23
Advanced print_list function in python
import random
def print_list(list_to_print: list, title: str = None, bullet_point: str = "•", max_items: int = None, randomize: bool = False, indent_level: int = 0) -> None:
"""
Prints a list nicely. Handles sublists. Tupples will be displayed as items: ('e1', 'e2', ...).
Author: Valérien BRAYE (@brayevalerien on github)
Args:
list_to_print (list): the list to be printed
@brayevalerien
brayevalerien / monokai.md
Last active October 16, 2024 11:45
Monokai theme color codes

Monokai theme color codes

Intro

This document lists the colors used in the Monokai Pro theme with the Classic filter. Please check the Monokai Pro website for more informations.

Colors

Monokai Pro with Classic filter colors:

Preview Hexadecimal RGB
Activity Bar Background activity bar background preview #272822 (39, 40, 34)
Activity Bar Foreground activity bar foreground preview #f8f8f2 (248, 248, 242)