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

utils.download_from_url from torchtext 0.10.0 has a problem. #1359

Open
YonghyunRyu opened this issue Jul 20, 2021 · 1 comment
Open

utils.download_from_url from torchtext 0.10.0 has a problem. #1359

YonghyunRyu opened this issue Jul 20, 2021 · 1 comment

Comments

@YonghyunRyu
Copy link

YonghyunRyu commented Jul 20, 2021

🐛 Bug

Describe the bug
I tried to download a file from google drive file id using the function utils.download_from_url with 0.10.0.
The logic of the function has a problem so I can not download the file.

To Reproduce

import torchtext
file_id = "https://drive.google.com/uc?id=1qx-Y6CfUsEWrOPX_Mzsz73uEBvmn6PyH"
torchtext.utils.download_from_url(file_id)

this code raised an error.

Expected behavior
But, I think this must download the file.

Environment
python==3.9
torchtext==0.10.0
Ubuntu 20.04

Additional context
Add any other context about the problem here.

I found a solution
In the code, https://github.com/pytorch/text/blob/v0.10.0/torchtext/utils.py
If I remove the code from line number 133 to 140 as below.

    if confirm_token is None:
        if "Quota exceeded" in str(response.content):
            raise RuntimeError(
                "Google drive link {} is currently unavailable, because the quota was exceeded.".format(
                    url
                ))
        else:
            raise RuntimeError("Internal error: confirm_token was not found in Google drive link.")

I do not know what is the role of confirm_token.
But If I skip using the confirmed token, the code works well.

@parmeet
Copy link
Contributor

parmeet commented Jul 21, 2021

Thanks @YonghyunRyu for raising the issue. It seems the link doesn't offer confirm_token and it currently only support downloading from google drive links that have confirm_token. Although I do not see reason why we should not support google drive downloads without confirm_token. Let me fix it in the Master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants