santa hat
deerdeer nosedeer glow
Sign In

Simple script to make a wildcard file from your textual inversions


This lets you specify a directory and everything gets put one-per-line into a text file you name. It's an easy way to randomly select from all your person embeddings with an extension like Dynamic Prompts or Wildcards. Code below, could not attach without triggering a bug. Save it to a file, I recommend ''. If you run the file on the command line ('python') it will tell you how to use it.


import os

import sys

from pathlib import Path

def list_files(directory, output_file, extension):

with open(output_file, 'w') as f:

for filename in os.listdir(directory):

file_path = Path(filename)

if file_path.suffix == extension:


if name == "__main__":

if len(sys.argv) != 4:

print("Usage: python <directory = embeddings> <output_file = embeddings.txt> <extension = .pt>")


directory = sys.argv[1]

list_files(directory, sys.argv[2], sys.argv[3])