Skip to content
Merged
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
8 changes: 5 additions & 3 deletions torchvision/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ def list_files(root: str, suffix: str, prefix: bool = False) -> List[str]:


def _quota_exceeded(response: "requests.models.Response") -> bool: # type: ignore[name-defined]
return False
# See https://github.com/pytorch/vision/issues/2992 for details
# return "Google Drive - Quota exceeded" in response.text
try:
start = next(response.iter_content(chunk_size=128, decode_unicode=True))
return isinstance(start, str) and "Google Drive - Quota exceeded" in start
except StopIteration:
return False


def download_file_from_google_drive(file_id: str, root: str, filename: Optional[str] = None, md5: Optional[str] = None):
Expand Down