Skip to content

Commit

Permalink
Add gdown support for drive downloads (more reliable)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorarad authored Feb 14, 2022
1 parent 7267aab commit 995449a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pytorch_version/dnnlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import urllib
import urllib.request
import uuid
import gdown

from distutils.util import strtobool
from typing import Any, List, Tuple, Union
Expand Down Expand Up @@ -394,6 +395,10 @@ def open_url(url: str, cache_dir: str = None, num_attempts: int = 10, verbose: b
filename = cache_files[0]
return filename if return_filename else open(filename, "rb")

if "drive.google" in url:
filename = gdown.download(url, quiet = False)
return open(filename, "rb")

# Download
url_name = None
url_data = None
Expand Down

0 comments on commit 995449a

Please sign in to comment.