I see the extension in the Extension tab, but it isn't loading.
The only error I see during the launch of webui is one related to decord.
File "\stable-diffusion-webui\extensions\Text2Video-Zero-sd-webui\scripts\main.py", line 5, in
from model import Model, ModelType
File "\stable-diffusion-webui\extensions\Text2Video-Zero-sd-webui\model.py", line 6, in
import decord
ModuleNotFoundError: No module named 'decord'
the only line referencing decord was commented out, so I also commented out the import decordpart.
in model.py, but it is also used in utils.py
could be replaced with opencv
Here's the updated function
def prepare_video(video_path:str, resolution:int, device, dtype, normalize=True, start_t:float=0, end_t:float=-1, output_fps:int=-1):
vr = cv2.VideoCapture(video_path)
initial_fps = vr.get(cv2.CAP_PROP_FPS)
if output_fps == -1:
output_fps = int(initial_fps)
if end_t == -1:
end_t = vr.get(cv2.CAP_PROP_FRAME_COUNT) / initial_fps
else:
end_t = min(vr.get(cv2.CAP_PROP_FRAME_COUNT) / initial_fps, end_t)
assert 0 <= start_t < end_t
assert output_fps > 0
start_f_ind = int(start_t * initial_fps)
end_f_ind = int(end_t * initial_fps)
num_f = int((end_t - start_t) * output_fps)
sample_idx = np.linspace(start_f_ind, end_f_ind, num_f, endpoint=False).astype(int)
video = []
for idx in sample_idx:
vr.set(cv2.CAP_PROP_POS_FRAMES, idx)
ret, frame = vr.read()
if not ret:
break
video.append(frame)
video = np.stack(video)
video = rearrange(video, "f h w c -> f c h w")
video = torch.Tensor(video).to(device).to(dtype)
h, w, _ = video.shape[1:] + (3,)
if h > w:
w = int(w * resolution / h)
w = w - w % 8
h = resolution - resolution % 8
else:
h = int(h * resolution / w)
h = h - h % 8
w = resolution - resolution % 8
video = Resize((h, w), interpolation=InterpolationMode.BILINEAR, antialias=True)(video)
if normalize:
video = video / 127.5 - 1.0
return video, output_fps
I see the extension in the Extension tab, but it isn't loading. The only error I see during the launch of webui is one related to decord.
File "\stable-diffusion-webui\extensions\Text2Video-Zero-sd-webui\scripts\main.py", line 5, in
from model import Model, ModelType
File " \stable-diffusion-webui\extensions\Text2Video-Zero-sd-webui\model.py", line 6, in
import decord
ModuleNotFoundError: No module named 'decord'
the only line referencing decord was commented out, so I also commented out the
import decord
part. in model.py, but it is also used in utils.py could be replaced with opencvHere's the updated function
After that change the extension shows up in WebUI