-1

I have a repo that provided a model architecture, but not pretrained model. it actually provides a .pth file but it's dataset inside the file, is there any way to make the dataset to csv?

acedone
  • 3
  • 2

1 Answers1

0

.pth files saved with toch.save() are supposed to be binaries. using torch.load() you can get the dataset, and then save it again as a .csv with pandas for example

theophile
  • 191
  • 6
  • I'm using this to save it as csv, `temp_data = torch.load('data/example.pth') df = pd.DataFrame(temp_data) df.to_csv("testfile",index=False)` but it doesnt fully saving it, its writes ... on the matrix – acedone Jul 08 '22 at 13:31
  • What do you mean by it writes on the matrix? – theophile Jul 08 '22 at 13:33
  • ah what i mean is, do you know when array is way too long to print? that . . . . is there any way to print it fully w/o that . . . . – acedone Jul 08 '22 at 13:36
  • I see, `pd.to_csv()` will save it to a file. If you want to print the full dataframe you can use ` pd.option_context()`, see this post: https://stackoverflow.com/a/30691921/19492396 – theophile Jul 08 '22 at 14:28
  • thanks a lot, sorry for late reply, another problems make me forgot to vote for answer – acedone Jul 15 '22 at 17:33