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 / 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
@wolfgangmeyers
wolfgangmeyers / BUILD
Last active February 10, 2023 01:39
Eclipse setup script for bazel
java_binary(
name = "annotation_processors_ide",
create_executable = False,
runtime_deps = [
// annotation processor dependencies here
],
)
java_binary(
name = "project_deps",

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 / gunicorn-killer.sh
Created October 14, 2015 22:51
how to kill a gunicorn
ps aux | grep gunicorn | awk '{print $2}' | xargs kill -9
@wolfgangmeyers
wolfgangmeyers / bump.txt
Last active April 3, 2020 22:20
Going through the concourse tutorial of course.
0
@wolfgangmeyers
wolfgangmeyers / gist:7441fa146030f6929dd0
Last active July 15, 2018 01:11
Run an ansible playbook from the python api
# borrowed from https://groups.google.com/forum/#!topic/ansible-project/V1PoNJcXV_w
import ansible.runner
import ansible.playbook
from ansible import callbacks
from ansible import utils
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
@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 / README.md
Last active May 11, 2017 15:27
Sort interface boilerplate for golang in sublime text