11import importlib
2-
3- import torch
4- import numpy as np
52import math
6- from collections import abc
7- from einops import rearrange
8- from functools import partial
9-
103import multiprocessing as mp
11- from threading import Thread
4+ from collections import abc
5+ from inspect import isfunction
126from queue import Queue
7+ from threading import Thread
138
14- from inspect import isfunction
9+ import numpy as np
10+ import torch
1511from PIL import Image , ImageDraw , ImageFont
1612
1713
@@ -221,7 +217,7 @@ def rand_perlin_2d(shape, res, device, fade = lambda t: 6*t**5 - 15*t**4 + 10*t*
221217 grid = torch .stack (torch .meshgrid (torch .arange (0 , res [0 ], delta [0 ]), torch .arange (0 , res [1 ], delta [1 ]), indexing = 'ij' ), dim = - 1 ).to (device ) % 1
222218
223219 rand_val = torch .rand (res [0 ]+ 1 , res [1 ]+ 1 )
224-
220+
225221 angles = 2 * math .pi * rand_val
226222 gradients = torch .stack ((torch .cos (angles ), torch .sin (angles )), dim = - 1 ).to (device )
227223
@@ -249,8 +245,8 @@ def ask_user(question: str, answers: list):
249245def debug_image (debug_image , debug_text , debug_show = True , debug_result = False , debug_status = False ):
250246 if not debug_status :
251247 return
252-
253- image_copy = debug_image .copy ()
248+
249+ image_copy = debug_image .copy (). convert ( "RGBA" )
254250 ImageDraw .Draw (image_copy ).text (
255251 (5 , 5 ),
256252 debug_text ,
@@ -261,4 +257,4 @@ def debug_image(debug_image, debug_text, debug_show=True, debug_result=False, de
261257 image_copy .show ()
262258
263259 if debug_result :
264- return image_copy
260+ return image_copy
0 commit comments