Skip to content

Instantly share code, notes, and snippets.

View adamelliotfields's full-sized avatar
🤗
hf.co/adamelliotfields

Adam Fields adamelliotfields

🤗
hf.co/adamelliotfields
View GitHub Profile
@adamelliotfields
adamelliotfields / flux.ipynb
Last active September 9, 2024 15:17
Optimized FLUX.1 pipeline for Colab.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / model_index.json
Created September 4, 2024 13:46
Stable Diffusion v1.5 model_index.json
{
"_class_name": "StableDiffusionPipeline",
"_diffusers_version": "0.6.0",
"feature_extractor": [
"transformers",
"CLIPImageProcessor"
],
"safety_checker": [
"stable_diffusion",
"StableDiffusionSafetyChecker"
@adamelliotfields
adamelliotfields / module.py
Created August 31, 2024 17:26
Import a Python module from a Hugging Face repo
# https://hf.co/spaces/briaai/BRIA-2.3-T5/blob/main/app.py
import sys
from huggingface_hub import snapshot_download
repo_path = snapshot_download(repo_id="org/repo")
sys.path.append(repo_path)
from my_module import my_function # my_module.py
from my_other_module import my_other_function # my_other_module.py
@adamelliotfields
adamelliotfields / sd3.ipynb
Last active August 30, 2024 21:58
sd3.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / auraflow.ipynb
Last active August 30, 2024 22:25
auraflow.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / sdxl.ipynb
Last active September 9, 2024 15:06
Optimized SDXL pipeline for Colab.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / aspect_ratio.py
Created August 26, 2024 20:21
Python Aspect Ratio
def aspect_ratio(width=0, height=0):
if width <= 0 or height <= 0:
return None
a, b = width, height
while b:
a, b = b, a % b
gcd = a
return (width // gcd, height // gcd)
@adamelliotfields
adamelliotfields / upscale.py
Created August 11, 2024 17:51
Real-ESRGAN Upscaler CLI
# Real-ESRGAN CLI with ai-forever/Real-ESRGAN weights and inference code.
# Usage: python upscale.py [--scale {2,4,8}] [--out STR] [IMAGES ...]
import argparse
import os
import einops
import numpy as np
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
@adamelliotfields
adamelliotfields / kohya_hires_fix.ipynb
Last active July 27, 2024 23:23
Kohya-ss Hi-res Fix
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamelliotfields
adamelliotfields / secrets.md
Last active July 22, 2024 19:18
Setting Secrets Privately with `read`

Setting Secrets Privately with read

Instead of entering export GH_TOKEN=your_token, you can use read to set the variable without exposing it in your history:

read -s GH_TOKEN && export GH_TOKEN