Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/convert_dance_diffusion_to_diffusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from copy import deepcopy

import requests
import torch
from audio_diffusion.models import DiffusionAttnUnet1D
from diffusion import sampling
Expand Down Expand Up @@ -73,9 +74,14 @@ def __init__(self, global_args):

def download(model_name):
url = MODELS_MAP[model_name]["url"]
os.system(f"wget {url} ./")
r = requests.get(url, stream=True)

return f"./{model_name}.ckpt"
local_filename = f"./{model_name}.ckpt"
with open(local_filename, "wb") as fp:
for chunk in r.iter_content(chunk_size=8192):
fp.write(chunk)

return local_filename


DOWN_NUM_TO_LAYER = {
Expand Down