Add this snippet to visual studio code as described at https://code.visualstudio.com/docs/editor/userdefinedsnippets
Also see https://gist.github.com/wolfgangmeyers/c7de046903d1fdfcf450440d62779450 for the sublime text version.
#!/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__": |
Add this snippet to visual studio code as described at https://code.visualstudio.com/docs/editor/userdefinedsnippets
Also see https://gist.github.com/wolfgangmeyers/c7de046903d1fdfcf450440d62779450 for the sublime text version.
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 { |
0 |
# 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) |
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.