How to specify the download destination path of untar_data in new version

in old version, untar_data can use parameters “fname” and “dest” to specify the path,
but in new version, these two parameters was removed, the document has not been updated, I try new parameters “data” and “archive” , it doesn’t work.

Try

path = Path('/content')
untar_data(URLs.MNIST_SAMPLE, data=path)

the data parameter is where the data will download

image

1 Like

thank you so much, I thought parameters was string type like old version.
I have another question, when I use absolute path, it download to correct path, if I use relative path like data=Path("./data"), it doesn’t work.
Is it a windows system problem?

Yeah @hanmala I tried that too. Not sure what the problem is, I get the same on colab.

However, you could use an alternative to untar_data

from fastdownload import *
p =  Path('./data')
if not p.exists():
  p.mkdir()

f = FastDownload(base=p.name, module=fastai.data)
f.get(URLs.MNIST_TINY)

the returned path to your data would be ./data/data/mnist_tiny

Thank you again,
I looked at the source code, the download path is “self.config_path/v”,
Path(’~/.fastai’) / Path(’./abc’), it will return Path(‘C:/Users/username/.fastai/abc’)
Path(’~/.fastai’) / Path(‘D:/abc’), it will return Path(‘D:/abc’)

I am using a container (singularity) and how to save the data outside of the container into my local machine.

Obviously, my container has no space left and I got the following error:

OSError: [Errno 28] No space left on device