Skip to content

Commit d603ccb

Browse files
authored
Small change to download in dance diffusion convert script (huggingface#7070)
* update * make style
1 parent fd0f469 commit d603ccb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/convert_dance_diffusion_to_diffusers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
from copy import deepcopy
66

7+
import requests
78
import torch
89
from audio_diffusion.models import DiffusionAttnUnet1D
910
from diffusion import sampling
@@ -73,9 +74,14 @@ def __init__(self, global_args):
7374

7475
def download(model_name):
7576
url = MODELS_MAP[model_name]["url"]
76-
os.system(f"wget {url} ./")
77+
r = requests.get(url, stream=True)
7778

78-
return f"./{model_name}.ckpt"
79+
local_filename = f"./{model_name}.ckpt"
80+
with open(local_filename, "wb") as fp:
81+
for chunk in r.iter_content(chunk_size=8192):
82+
fp.write(chunk)
83+
84+
return local_filename
7985

8086

8187
DOWN_NUM_TO_LAYER = {

0 commit comments

Comments
 (0)