Skip to content

Instantly share code, notes, and snippets.

import rp
import numpy as np
import replicate
@rp.globalize_locals
def run_vace_via_replicate(video, mask, prompt="", name=""):
video = rp.as_byte_images(rp.as_rgb_images(video))
mask = rp.as_byte_images(rp.as_rgb_images(mask ))
assert video.shape == mask.shape, (video.shape, mask.shape)
import rp
import numpy as np
import replicate
@rp.globalize_locals
def run_vace_via_replicate(video, mask, prompt="", name=""):
video = rp.as_byte_images(rp.as_rgb_images(video))
mask = rp.as_byte_images(rp.as_rgb_images(mask ))
assert video.shape == mask.shape, (video.shape, mask.shape)
import numpy as np
import replicate
@globalize_locals
def run_vace_via_replicate(video, mask, prompt="", name=""):
video = as_byte_images(as_rgb_images(video))
mask = as_byte_images(as_rgb_images(mask ))
assert video.shape == mask.shape, (video.shape, mask.shape)
#mask = invert_images(mask) #They do it the opposite of me, I like white to mean "keep"
for _ in range(10):
import rp
import torch
from diffusers import CogVideoXImageToVideoPipeline
from diffusers.utils import export_to_video, load_image
from rp.libs.torch_tools import resize_conv2d_channels
device = rp.select_torch_device(prefer_used=True,reserve=True)
def i2v_to_t2v(transformer):
import rp
transformer_root = "/home/jupyter/CleanCode/Checkpoints/Github/DiffusionAsShader/ckpts/your_ckpt_path/CounterChans_RandomSpeed_WithDropout_2500_10000000__optimizer_adamw__lr-schedule_cosine_with_restarts__learning-rate_1e-4/checkpoint-14700/transformer"
transformer_root = "/home/jupyter/CleanCode/Huggingface/CogVideoX-5b/transformer"
safetensor_paths = rp.get_all_files(transformer_root, file_extension_filter="safetensors")
# Announce
rp.fansi_print(
f"Loading Safetensors from {transformer_root}\n"
+ rp.indentify(
from rp import mean
import math
import numpy as np
class Quadrilateral:
def __init__(self, x0, x1, x2, x3, y0, y1, y2, y3):
self.x0, self.x1, self.x2, self.x3 = x0, x1, x2, x3
self.y0, self.y1, self.y2, self.y3 = y0, y1, y2, y3
from rp import mean
import math
import numpy as np
class Quadrilateral:
def __init__(self, x0, x1, x2, x3, y0, y1, y2, y3):
self.x0, self.x1, self.x2, self.x3 = x0, x1, x2, x3
self.y0, self.y1, self.y2, self.y3 = y0, y1, y2, y3
def temporal_dropout_boolean_list(length, proportion=0.5):
"""
Creates a boolean list with temporal dropout patterns.
Generates a list of length 'length' containing boolean values where
some values are randomly dropped out (set to False) according to the
specified proportion, tending torwards contiguous chunks.
Args:
length (int): The length of the output list.
import requests
import os
import PIL
def rebind_globals_to_module(module, *, monkey_patch=False):
"""
Decorator to change the global environment of functions and classes to another module's namespace.
If monkey_patch is True, the function or class is also added to the module.
The result: the decorated function is as good as if it were created in that module's source code,
This file has been truncated, but you can view the full file.
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
#THINGS TO DO BEFORE OFFICIAL RELEASE:
# Rename "path" functions to "2d-somethings" idk what, but it conflicts with file-paths...
# Rename "display" functions to "plot" functions. "display" functions should be very simple and library-agnostic, while plot can be matplotlib-based.
# Remove useless functions, and categorize them. Probably should split into multiple files; but that's kinda messy...
# These functions don't have to be removed from r.py, they just have to be deleted from rp.py (after using from r import *, use something like 'del useless_function')
#TODO: Turn the comments at the beginning of each function into docstrings so they can be read by the builtin help function
# python /Users/Ryan/PycharmProjects/Py27RyanStandard2.7/Groupie.py ftF11dwbP61OfPf9QsXBfS5usCdQdBkkMieObdvZ -g 'The Think Tank'