Skip to content

Instantly share code, notes, and snippets.

@tezheng
tezheng / blog.md
Created July 7, 2023 03:20 — forked from Hellisotherpeople/blog.md
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

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, highly detailed, digital painting, artstation, concept art, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, intricate, highly detailed, smooth, digital illustration
- pirate, concept art, deep focus, fantasy, intricate, highly detailed, digital painting, matte, sharp focus, illustration
- red dead redemption 2, cinematic view, epic sky, detailed, concept art, 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
@tezheng
tezheng / find_noise.py
Created July 7, 2023 03:20 — forked from trygvebw/find_noise.py
A "reverse" version of the k_euler sampler for Stable Diffusion, which finds the noise that will reconstruct the supplied image
import torch
import numpy as np
import k_diffusion as K
from PIL import Image
from torch import autocast
from einops import rearrange, repeat
def pil_img_to_torch(pil_img, half=False):
image = np.array(pil_img).astype(np.float32) / 255.0
@tezheng
tezheng / macOS Internals.md
Created May 7, 2023 07:14 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

import time
import torch
from torch import cuda
def gpu_utilization(type='gpu'):
import subprocess
if type=='gpu':
# utilization.gpu
@tezheng
tezheng / README.md
Created April 23, 2023 11:46 — forked from corlaez/README.md
Hexagonal Architecture and Modular Implementation

Hexagonal Architecture

Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters".

In a nutshell:

Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect
@tezheng
tezheng / github-actions-notes.md
Created March 1, 2023 12:19 — forked from br3ndonland/github-actions-notes.md
Getting the Gist of GitHub Actions
@tezheng
tezheng / launch.json
Created July 31, 2022 17:08 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@tezheng
tezheng / 01-initial-setup.sh
Created May 22, 2022 11:39 — forked from pixelmattersdev/01-initial-setup.sh
How to set up a project from top to bottom blog post
npm init vite@latest demo-project -- --template react-ts