Skip to content

Instantly share code, notes, and snippets.

@kohya-ss
kohya-ss / forward_of_sdxl_original_unet.py
Created November 14, 2023 03:39
SDXLで高解像度での構図の破綻を軽減する
def forward(self, x, timesteps=None, context=None, y=None, **kwargs):
# broadcast timesteps to batch dimension
timesteps = timesteps.expand(x.shape[0])
hs = []
t_emb = get_timestep_embedding(timesteps, self.model_channels) # , repeat_only=False)
t_emb = t_emb.to(x.dtype)
emb = self.time_embed(t_emb)
assert x.shape[0] == y.shape[0], f"batch size mismatch: {x.shape[0]} != {y.shape[0]}"
@Stella2211
Stella2211 / DeepFloyd_IF_VRAM12GB.py
Last active January 17, 2024 03:59
DeepFloyd IF for around 12GB of VRAM
# huggingface login
from huggingface_hub import login
login()
# load textencorder in 8bit quantized
from transformers import T5EncoderModel
from diffusers import DiffusionPipeline
import datetime
@Norod
Norod / text-to-video-modelscope.py
Created April 16, 2023 08:08
Running ModelScope text2video locally with torch 2 gpu memory optimizations and control over parameters
# Ran it with the following packages installed:
# accelerate 0.18.0
# diffusers 0.16.0.dev0
# torch 2.0.0+cu118
# torchvision 0.15.0+cu118
# transformers 4.28.1
# xformers 0.0.18
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
bl_info = {
"name": "Kuchi Paku Light",
"author": "ds54e",
"version": (1, 1, 1),
"blender": (2, 80, 0),
"location": "View3D > Sidebar > KPL",
"description": "Generate Kuchi-Paku animations from the sound sequences in the VSE",
"warning": "",
"doc_url": "",
"category": "Animation",
@ZoomTen
ZoomTen / Node Tricks (Olive 0.2.x).md
Last active July 25, 2021 14:56
Sick Node Tricks - or, how to reproduce common effects using the node editor.

General Tips and Tricks

  • Think of clip nodes as containers!
    • You can plug in an arbitrary composite node and make them "instances" of said node

Common Node Configurations

Drop shadow (TinglesMagicWords)

A simple drop shadow effect, assuming you have a solid color and transparent clip such as text.

@Celeborn2BeAlive
Celeborn2BeAlive / build_otio_wheel.sh
Created May 20, 2020 17:39
Shell script to build a wheel of OpenTimelineIO 0.12.1
#!/bin/bash
# This script generate a wheel for OpenTimelineIO in dist folder
# We need it has a patch to install otio 0.12.1 in Windows Blender because it requires compilation
# This wheel should be distributed with code that depends on otio 0.12.1 and installed using Blender's python -m pip
# You need python (3.7.*) and Visual Studio 2017+
CURRENT_DIR=`dirname $0`
ROOT_DIR=$CURRENT_DIR/
@tokejepsen
tokejepsen / otio_to_ffmpeg.py
Last active November 24, 2020 08:48
OTIO to FFMPEG
import subprocess
import sys
import os
import json
import shutil
import requests
import opentimelineio as otio
@alchem0x2A
alchem0x2A / blender_snippet_2.8x_1.org
Created September 15, 2019 20:40
New python snippets Blender 2.8x
@ethanaeris
ethanaeris / fastlandscape2_8.py
Last active September 11, 2022 07:17
Fast Landscape for Blender 2.8
# -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@twilson90
twilson90 / get_anim_datas
Created March 31, 2019 00:04
a helpful function for finding most of the animation datas used in a context or scene
def get_anim_datas(context=None):
if context is None: context = bpy.context
found = set()
materials = set()
textures = set()
def found_add(o):
if o is None: raise Exception()
found.add(o)
found_add(context.scene)