remove tqdm

This commit is contained in:
wataru 2023-05-16 20:56:17 +09:00
parent 44593719f5
commit 71683c859b
2 changed files with 28 additions and 3 deletions

View File

@ -131,6 +131,28 @@ def download(params):
print(e) print(e)
def download_no_tqdm(params):
url = params["url"]
saveTo = params["saveTo"]
dirname = os.path.dirname(saveTo)
if dirname != "":
os.makedirs(dirname, exist_ok=True)
try:
req = requests.get(url, stream=True, allow_redirects=True)
with open(saveTo, "wb") as f:
countToDot = 0
for chunk in req.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
countToDot += 1
if countToDot % 1024 == 0:
print(".", end="")
print("+", end="")
except Exception as e:
print(e)
def downloadWeight(): def downloadWeight():
# content_vec_500 = (args.content_vec_500,) # content_vec_500 = (args.content_vec_500,)
# content_vec_500_onnx = (args.content_vec_500_onnx,) # content_vec_500_onnx = (args.content_vec_500_onnx,)
@ -232,7 +254,7 @@ if __name__ == "MMVCServerSIO":
) )
try: try:
download({"url": SAMPLES_JSON, "saveTo": args.samples, "position": 0}) download_no_tqdm({"url": SAMPLES_JSON, "saveTo": args.samples, "position": 0})
except Exception as e: except Exception as e:
print("[Voice Changer] loading sample failed", e) print("[Voice Changer] loading sample failed", e)

View File

@ -6,7 +6,7 @@ from dataclasses import asdict
from typing import cast from typing import cast
import numpy as np import numpy as np
import torch import torch
from MMVCServerSIO import download from MMVCServerSIO import download_no_tqdm
from ModelSample import RVCModelSample, getModelSamples from ModelSample import RVCModelSample, getModelSamples
@ -130,8 +130,11 @@ class RVC:
"position": 2, "position": 2,
} }
) )
print("[Voice Changer] Downloading model files...", end="")
with ThreadPoolExecutor() as pool: with ThreadPoolExecutor() as pool:
pool.map(download, downloadParams) pool.map(download_no_tqdm, downloadParams)
print("")
return modelPath, indexPath, featurePath return modelPath, indexPath, featurePath
def loadModel(self, props: LoadModelParams): def loadModel(self, props: LoadModelParams):