Sign In

Print PickleTensor .pt File Informations

0
Print PickleTensor .pt File Informations

Foreword

In this article I assume that there is a PickleTensor file .pt in zip archive format, how the file is used in Embeddings and Hypernetworks.

As I showed in a former article data from .pt files are truncated related to the tensor printouts. In the first shot this was not of interest for me. Now I wanted to see more. So I figured out how to see the full informations.

When we import torch we have everything which we need to use to print the data of interest. Following prints the basic informations in a .pt file.

# Get data.
data=torch.load(filename)

# Print data.
print(data)

To get untruncated informations about the tensor, one has to add in the head of a Python script the following [2].

torch.set_printoptions(threshold=10_000)

You can find the Python scripts in reference [1].

Outlook

I a next article I will explain the current .pt format a little bit. That helps to understand what one can see applying the print out Python scripts.

That then gives also an idea, how Embeddings, Hypernetworks and Checkpoints can be organised.

Final words

I added a repository for Artificial Intelligence Tools to my GitHub web space. There will be all the small tools I wrote in the next future.

Understanding the .pt file structure allows me to build a bridge from .pt or .bin files to .saftensor files. I am also beginning to understand the internal structure of Embeddings and Hypernetworks.

Finally

Have a nice day! Have fun! Be inspired!

Reference

[1] https://github.com/zentrocdot/artificial-intelligence-tools/tree/main/python

[2] https://pytorch.org/docs/stable/generated/torch.set_printoptions.html#torch.set_printoptions

0

Comments