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

Fix bug in URLs.path() in 04_data.external #3582

Merged
merged 1 commit into from Feb 16, 2022

Conversation

malligaraj
Copy link
Contributor

@malligaraj malligaraj commented Feb 16, 2022

In URLs.path(), there is a check to see if the file to download exists in folders data or models in URLs.LOCAL_PATH.

The key to the Config is set to models instead of model when forming the local path. The key should be one of ['archive', 'data', 'model', 'storage'] according to URLs docs

I have tried the following:

  1. Current working director is empty (path pointed by LOCAL_PATH = Path.cwd())
  2. Run URLs.path() with different values for c_key ['data', 'archive', 'storage', 'model']
for k in ['data', 'archive', 'storage', 'model']:
    print(URLs.path(URLs.MNIST_TINY,c_key=k))

"""
Output:

/root/.fastai/data/mnist_tiny.tgz
/root/.fastai/archive/mnist_tiny.tgz
/root/.fastai/tmp/mnist_tiny.tgz
/root/.fastai/models/mnist_tiny.tgz
"""

Then,

  1. Copied mnist_tiny.tgz to my current directory under folders data and models
  2. Ran the same code as above
for k in ['data', 'archive', 'storage', 'model']:
    print(URLs.path(URLs.MNIST_TINY,c_key=k))

"""
Output:

/content/data/mnist_tiny.tgz
/content/data/mnist_tiny.tgz
/content/data/mnist_tiny.tgz
/content/data/mnist_tiny.tgz  # <---
"""

I was expecting the last output line in the second run (marked by <---) to be /content/models/mnist_tiny.tgz.

So I have changed the key value that is compared

In URLs.path(), there is a check to see if the file to download
exists in folders `data` or `models` in current working directory
and return path to that file

The key to the `Config` is set to `models` instead of `model` when
forming the local path. The key shoule be one of ['archive', 'data',
'model', 'storage'] according to the docs
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jph00 jph00 merged commit ca9c60d into fastai:master Feb 16, 2022
@jph00 jph00 added the bug label Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants