Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on the json Module in Python

Tips and Traps

  1. It is suggested that you avoid using JSON for serializing and deserializing data. Please refer to Shotcomes of JSON for detailed discussions on this. TOML and YAML are better text-based alternatives to JSON. If serialization and deserialization is done in Python only, pickle

Save and Load PyTorch Models

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. PyTorch uses pickle to serialize and deserialize objects.

  2. The PyTorch convention is to use the file extension .pt or .pth for saving model (or its parameters) and use the file extension …