I have a repo that provides a .pth file but as a dataset, is there any way to transform it to a more readable form like CSV?
Assuming you can access the actual data as a tensor in your Dataset
, you could transform it to a numpy.array
and save it via numpy.savetxt("data.csv", a, delimiter=",")
.
it says that ValueError: only one element tensors can be converted to Python scalars
You can load it using torch.load
, and see what data and types you have in it. Then based on that, you can parse/transform it according to your needs, and save that as you want it to be. Feel free to share the results of loading it, that would help us too!