Skip to content

Instantly share code, notes, and snippets.

import argparse
import torch
from safetensors.torch import load_file, safe_open
from library import model_util
def load_state_dict(file_name, dtype):
if model_util.is_safetensors(file_name):
# Copyright © 2023 Dave Lage
#
# 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:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE U
import torch
from datasets import Dataset, Image, load_dataset
from torchmetrics.image.fid import FrechetInceptionDistance
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
from torchvision import transforms
import random
from matplotlib import pyplot as plt
import argparse
from pathlib import Path
import numpy
from torchmetrics.functional.multimodal import clip_score
from functools import partial
import torch
from datasets import load_dataset
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
import random
from pathlib import Path
import argparse
import numpy
# Original from https://gist.github.com/Poiuytrezay1/db6b98672675456bed39d45077d44179
# Credit to Poiuytrezay1
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
# Original from https://gist.github.com/Poiuytrezay1/db6b98672675456bed39d45077d44179
# Credit to Poiuytrezay1
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
import tqdm
from PIL import Image
from torchvision import transforms
@rockerBOO
rockerBOO / skybox_styles.txt
Last active April 18, 2023 17:19
Skybox styles
5 Digital Painting
2 Fantasy Lands
3 Anime Art Style
4 Surreal Style
6 Scenic
9 Realistic
20 Modern Computer Animation
10 SciFi
11 Dreamlike
15 Interior Views
@rockerBOO
rockerBOO / aesthetic.txt
Created December 18, 2022 18:39
A list of aethetics (may be NSFW)
cloudcore
ulzzang
70's disco
2-tone
1950's suburbia
2000's autmn
2014 girly tumblr
2k animecore
Abstract Tech
Acid Pixie
@rockerBOO
rockerBOO / build.sh
Created November 27, 2022 20:48
Example running sound effect based on the exit code of a command. Customize to taste.
#!/usr/bin/env bash
success_sound="$HOME/code/audio-player/creamy2.ogg"
failure_sound="$HOME/code/audio-player/output.ogg"
# https://github.com/rockerBOO/audio-player
player="$HOME/code/audio-player/target/release/audio-player"
cargo build "$@"
last_run=$?