Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add download directory to the argument parser. #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all 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, download_directory=""):
file_path = file_spec['file_path']
file_url = file_spec['file_url']
file_path = os.path.join(download_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('--download_directory', help="directory to save the downloaded files (default: current folder)", default="")

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