mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
remove invalid downloaded files
This commit is contained in:
@@ -35,6 +35,9 @@ def download_civit_model(model_url: str, model_name: str, model_path: str, previ
|
||||
written = written + len(data)
|
||||
f.write(data)
|
||||
progress.update(task, advance=block_size, description="Downloading")
|
||||
if written < 1024 * 1024 * 1024: # min threshold
|
||||
os.remove(model_file)
|
||||
raise ValueError(f'removed invalid download: bytes={written}')
|
||||
if preview is not None:
|
||||
preview_file = os.path.splitext(model_file)[0] + '.jpg'
|
||||
preview.save(preview_file)
|
||||
|
||||
@@ -18,7 +18,8 @@ local_url = None
|
||||
errors.log.debug('Loading Torch')
|
||||
import torch # pylint: disable=C0411
|
||||
try:
|
||||
errors.log.debug(f'Torch init: {torch.sum(torch.randn(2, 2)).to(0) > 0}') # fix silly pytorch_lightning issue
|
||||
rnd = torch.sum(torch.randn(2, 2)).to(0)
|
||||
errors.log.debug(f'Torch init: {rnd / rnd == 1.0}') # fix silly pytorch_lightning issue
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user