pytorch/torch/csrc/jit/python
atannous 3ed1569e86 Adding serialization ID to inline container (#100994)
Summary:
In order to better track models after serialization, this change writes a serialization_id as a UUID to inline container. Having this ID enables traceability of model in saving and loading events.
serialization_id is generated as a new UUID everytime serialization takes place. It can be thought of as a model snapshot identifier at the time of serialization.

Test Plan:
```
buck2 test @//mode/dev //caffe2/caffe2/serialize:inline_container_test
```

Local tests:
```
buck2 run @//mode/opt //scripts/atannous:example_pytorch_package
buck2 run @//mode/opt //scripts/atannous:example_pytorch
buck2 run @//mode/opt //scripts/atannous:example_pytorch_script
```

```
$ unzip -l output.pt
Archive:  output.pt
  Length      Date    Time    Name
---------  ---------- -----   ----
       36  00-00-1980 00:00   output/.data/serialization_id
      358  00-00-1980 00:00   output/extra/producer_info.json
       58  00-00-1980 00:00   output/data.pkl
      261  00-00-1980 00:00   output/code/__torch__.py
      326  00-00-1980 00:00   output/code/__torch__.py.debug_pkl
        4  00-00-1980 00:00   output/constants.pkl
        2  00-00-1980 00:00   output/version
---------                     -------
     1045                     7 files
```

```
unzip -p output.pt "output/.data/serialization_id"
a9f903df-cbf6-40e3-8068-68086167ec60
```

Differential Revision: D45683657

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100994
Approved by: https://github.com/davidberard98
2023-05-17 17:08:48 +00:00
..
init.cpp Adding serialization ID to inline container (#100994) 2023-05-17 17:08:48 +00:00
init.h
module_python.h
pybind_utils.cpp ASAN: fix use-after-free (#101400) 2023-05-15 15:32:10 +00:00
pybind_utils.h Revert "Reduce includes of CUDACachingAllocator.h (#97072)" 2023-04-07 06:15:11 +00:00
pybind.h
python_arg_flatten.cpp
python_arg_flatten.h
python_custom_class.cpp
python_custom_class.h
python_dict.cpp
python_dict.h
python_interpreter.cpp
python_ir.cpp Add Symbool support in python to C++ translation (#98453) 2023-04-12 03:21:57 +00:00
python_ir.h
python_ivalue.h
python_list.cpp
python_list.h
python_sugared_value.cpp [JIT] clarify errors due to non-literal indexing into ModuleList, ModuleDict (#98606) 2023-04-18 02:53:53 +00:00
python_sugared_value.h
python_tracer.cpp do not need to check if element in dict input is Tensor. (#97866) 2023-03-31 19:39:00 +00:00
python_tracer.h
python_tree_views.cpp
python_tree_views.h
script_init.cpp Allow C++ custom class to define __repr__ and use it from Python (#100724) 2023-05-10 15:46:45 +00:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h
utf8_decoding_ignore.cpp Optionally ignore utf-8 decoding error when converting std::string to python str. (#97282) 2023-03-23 01:19:08 +00:00
utf8_decoding_ignore.h Optionally ignore utf-8 decoding error when converting std::string to python str. (#97282) 2023-03-23 01:19:08 +00:00