Description
Looking at the documentation here:
TorchSharp/src/TorchVision/dsets/MNIST.cs
Lines 17 to 29 in fbb4b55
The expected behavior is that if I pass foobar/
as the value for root
, the dataset should be downloaded to foobar/mnist/some-archive-name.tar.gz
. The actual behavior is that the dataset archive gets downloaded into the current working directory, then the method throws an exception because it fails to find the archive file at foobar/mnist/some-archive-name.tar.gz
.
The bug is due to a small typo in the DownloadFile()
method, found here:
TorchSharp/src/TorchVision/dsets/CIFAR.cs
Lines 86 to 99 in fbb4b55
On line 95, DownloadFile()
writes to the path stored in file
, whereas it should be writing to the path stored in filePath
.
DownloadFile()
is called here:
TorchSharp/src/TorchVision/dsets/MNIST.cs
Line 174 in fbb4b55
Assuming Download()
was called with root = "foobar"
and dataset = "mnist"
:
Download()
setsdatasetPath = "foobar/mnist"
andsourceDir = datasetPath
DownloadFile()
will be called withfile = "train-images-idx3-ubyte.gz"
andtarget = sourceDir = "foobar/mnist"
- Because of the typo,
DownloadFile()
writes totrain-images-idx3-ubyte.gz
instead offoobar/mnist/train-images-idx3-ubyte.gz
DecompressFile()
is later called withfile = "train-images-idx3-ubyte"
andsourceDir = "foobar/mnist"
DecompressFile()
expects the target file to be atfoobar/mnist/train-images-idx3-ubyte.gz
, but the file is actually at$(pwd)/train-images-idx3-ubyte.gz
I do not have a CLA signed with Microsoft, the .NET Foundation, or the TorchSharp repository, so I'm reporting this issue as-is rather than with a pull request. From what I've found, I believe this bug can be fixed with a 4 letter change that replaces file
with filePath
in the DownloadFile()
method.