Skip to content
Open
Changes from 2 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
4 changes: 3 additions & 1 deletion download_ffhq.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@

#----------------------------------------------------------------------------

def download_file(session, file_spec, stats, chunk_size=128, num_attempts=10):
def download_file(session, file_spec, stats, chunk_size=128, num_attempts=10, base_directory=""):
file_path = file_spec['file_path']
file_url = file_spec['file_url']
file_path = os.path.join(base_directory, file_path)
file_dir = os.path.dirname(file_path)
tmp_path = file_path + '.tmp.' + uuid.uuid4().hex
if file_dir:
Expand Down Expand Up @@ -384,6 +385,7 @@ def run_cmdline(argv):
parser.add_argument('--timing_window', help='samples for estimating download eta (default: 50)', type=int, default=50, metavar='LEN')
parser.add_argument('--chunk_size', help='chunk size for each download thread (default: 128)', type=int, default=128, metavar='KB')
parser.add_argument('--num_attempts', help='number of download attempts per file (default: 10)', type=int, default=10, metavar='NUM')
parser.add_argument('--base_directory', help="directory to save the downloaded files (default: current folder)", default="")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest calling the argument "download_directory" instead, because that makes more sense to the user.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Download directory is more intuitive. Updated the PR now.


args = parser.parse_args()
if not args.tasks:
Expand Down