Skip to content

Instantly share code, notes, and snippets.

View wolfgangmeyers's full-sized avatar

Wolfgang Meyers wolfgangmeyers

  • AiBrush
  • Washington State, USA
View GitHub Profile
@wolfgangmeyers
wolfgangmeyers / calligraphy.js
Last active August 20, 2024 22:47
Use with https://www.calligrapher.ai/ to automate handwriting of larger texts (paste into javascript console). Use text of any length. You will need to approve multiple downloads when running, but then it will download SVG handwriting of roughly evenly-sized chunks of text.
let text = `paste text of any size here`;
function splitIntoSegments(inputString) {
inputString = inputString.replace(/\n/g, " ")
const words = inputString.split(' ');
const segments = [];
let currentSegment = '';
for (let word of words) {
// strip each word of whitespace

A guide to fine-tune Stable Diffusion on the Vast.ai service

This guide is based on another more comprehensive one that can be found at https://note.com/kohya_ss/n/nbf7ce8d80f29. All of the necessary environment has been encapsulated into a docker image that can easily run on different cloud providers. (disclaimer: there seems to be a version mismatch with xformers, so we leave it off because it won't work)

Note: the docker image used for this exercise is based on Stable Diffusion 1.5 release and has the updated VAEs. By using the model contained in this image or any fine-tuned models derived from it, you agree to terms of use.

  1. Make sure you have an account with Vast.ai and some credit.
  2. Navigate to https://console.vast.ai/create/ and filter by A100 GPU type (others may work, but probably slower)
@wolfgangmeyers
wolfgangmeyers / clip_rank.py
Created May 18, 2022 04:24
Minimalistic script to print out the similarity between text and image using the CLIP model
# Adapted from https://github.com/Jack000/glid-3-xl
import clip
import argparse
import PIL
import torch
def rank(args):
device = torch.device('cuda:0' if (torch.cuda.is_available() and not args.cpu) else 'cpu')
clip_model, clip_preprocess = clip.load('ViT-L/14', device=device, jit=False)
clip_model.eval().requires_grad_(False)
@wolfgangmeyers
wolfgangmeyers / bump.txt
Last active April 3, 2020 22:20
Going through the concourse tutorial of course.
0
@wolfgangmeyers
wolfgangmeyers / retries.go
Created June 1, 2017 18:17
Golang WithRetries wrapper
package retries
import "time"
// WithRetries will continue to attempt an operation
// up to the specified number of retries with an exponential
// backoff. If the operation is still unsuccessful
// after all retries are exhausted (operation returns an error),
// that error is returned.
func WithRetries(retries int, operation func() error) error {
@wolfgangmeyers
wolfgangmeyers / README.md
Last active May 11, 2017 15:28
Implement a sortable type in go - visual studio code snippet
@wolfgangmeyers
wolfgangmeyers / watcher.py
Created April 21, 2017 16:22
Dead simple process watcher in python. Restarts a process if and only if it dies with a non-zero exit code. Shuts down if process exits with zero.
#!/usr/bin/env python
import sys
import os
# Dead simple process watcher in python.
# Restarts a process if and only if it dies with a non-zero exit code.
# Shuts down if process exits with zero.
if __name__ == "__main__":
@wolfgangmeyers
wolfgangmeyers / gist:9566680d26d8193d2b335ca10a10085a
Created March 23, 2017 13:17
Use sublime text from the command line on linux
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
@wolfgangmeyers
wolfgangmeyers / README.md
Last active May 11, 2017 15:27
Sort interface boilerplate for golang in sublime text
@wolfgangmeyers
wolfgangmeyers / golang-test-count.sh
Created October 21, 2016 20:28
How to count the number of running tests for a go project
go test ./... -v | grep -c RUN