Skip to content

Instantly share code, notes, and snippets.

View rayyee's full-sized avatar
🌴
On vacation

Ray Yee rayyee

🌴
On vacation
View GitHub Profile
@Hellisotherpeople
Hellisotherpeople / blog.md
Last active April 14, 2024 21:52
You probably don't know how to do Prompt Engineering, let me educate you.

You probably don't know how to do Prompt Engineering

(This post could also be titled "Features missing from most LLM front-ends that should exist")

Apologies for the snarky title, but there has been a huge amount of discussion around so called "Prompt Engineering" these past few months on all kinds of platforms. Much of it is coming from individuals who are peddling around an awful lot of "Prompting" and very little "Engineering".

Most of these discussions are little more than users finding that writing more creative and complicated prompts can help them solve a task that a more simple prompt was unable to help with. I claim this is not Prompt Engineering. This is not to say that crafting good prompts is not a difficult task, but it does not involve doing any kind of sophisticated modifications to general "template" of a prompt.

Others, who I think do deserve to call themselves "Prompt Engineers" (and an awful lot more than that), have been writing about and utilizing the rich new eco-system

@bluelovers
bluelovers / ChatGPT Stable Diffusion prompts generator.txt
Last active April 16, 2024 03:22
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- A ghostly apparition drifting through a haunted mansion's grand ballroom, illuminated by flickering candlelight. Eerie, ethereal, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, smooth
- pirate, deep focus, fantasy, matte, sharp focus
- red dead redemption 2, cinematic view, epic sky, detailed, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting, rpg portrait
@Pyr-000
Pyr-000 / $README.md
Last active April 16, 2024 07:58
Convert original Stable Diffusion checkpoints and safetensors to diffusers

Stable Diffusion model conversion script

Convert from the 'original implementation' to Huggingface diffusers. Both .safetensors and .ckpt checkpoints are supported.

The script is adapted from the diffusers conversion script: https://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.py

Usage:

python enhanced_convert_original_stable_diffusion_to_diffusers.py --checkpoint_path "<input_model_filepath>" --dump_path "<output_directory_path>" --extract_ema

For inference use, extracting with --extract_ema is usually recommended. This will be ignored if the source model does not contain both EMA and non-EMA weights.

# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
# Written by jachiam
import argparse
import os.path as osp
import torch
@bookfere
bookfere / fix-google-translate-cn.bat
Last active March 27, 2024 13:39
Fix Google Translate CN for Windows
:: Copyright (c)2022 https://bookfere.com
:: This is a batch script for fixing Google Translate and making it available
:: in the Chinese mainland. If you experience any problem, visit the page below:
:: https://bookfere.com/post/1020.html
@echo off
setlocal enabledelayedexpansion
chcp 437 >NUL
set "ips[0]=74.125.137.90"
@kermit4977
kermit4977 / get_embeddings.py
Last active July 29, 2023 20:42
Python script to get SD embeddings from the Stable Diffusion Textual Inversion Concepts Library for use with SD WebUI
#!/bin/python
####
# Designed for use with https://github.com/AUTOMATIC1111/stable-diffusion-webui
# Run this file from the root of the repo
#
# Usage in prompt: Put embedding name in prompt (using moxxi.pt and borderlands.pt)
# e.g. moxxi on a beach, in the style of borderlands sharp, clear lines, detailed
# or
# e.g. <moxxi> on a beach, in the style of <borderlands> sharp, clear lines, detailed
@mattdesl
mattdesl / cli.js
Created September 13, 2022 10:37
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
@nateraw
nateraw / stable_diffusion_walk.py
Created August 18, 2022 05:59
Walk between stable diffusion text prompts
"""
Built on top of this gist by @karpathy:
https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355
stable diffusion dreaming over text prompts
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stable_diffusion_walk.py --prompts "['blueberry spaghetti', 'strawberry spaghetti']" --seeds 243,523 --name berry_good_spaghetti
@karpathy
karpathy / stablediffusionwalk.py
Last active April 25, 2024 11:25
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4