Skip to content

Commit

Permalink
Download fix (#20)
Browse files Browse the repository at this point in the history
* Fixed download.py

* Fix download.py
  • Loading branch information
outrun32 authored Jan 26, 2024
1 parent 52c2349 commit f59c7f8
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions scripts/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"-r",
"--range",
type=int,
default=2000,
default=None,
help="Upper bound of range if -i is provided",
)
parser.add_argument(
Expand Down Expand Up @@ -69,14 +69,6 @@
if args.large:
large = args.large

if (
args.index and args.range and args.output and args.unzip and args.large is None
): # if no arguments are provided, set default behaviour
index = 1
range_max = 2000
output = "images"
unzip = False
large = False


def download(index=1, range_index=0, output="", large=False):
Expand Down Expand Up @@ -192,11 +184,11 @@ def main(index=None, range_max=None, output=None, unzip=None, large=None):
images) instead of DiffusionDB 2M (2 million images)
:return: A list of files that have been downloaded
"""
if range_max - index > 1999:
confirmation = input("Do you have at least 1.7Tb free: (y/n)")
if confirmation != "y":
return
if index and range_max:
if range_max - index >= 1999:
confirmation = input("Do you have at least 1.7Tb free: (y/n)")
if confirmation != "y":
return
files = download(index, range_max, output, large)
if unzip:
unzip_all(files)
Expand All @@ -211,4 +203,4 @@ def main(index=None, range_max=None, output=None, unzip=None, large=None):
# to import the script into the interpreter without automatically running the
# main function.
if __name__ == "__main__":
main(index, range_max, output, unzip, large)
main(index, range_max, output, unzip, large)

0 comments on commit f59c7f8

Please sign in to comment.