Commit Graph

10 Commits

Author SHA1 Message Date
8dc6001057 [export] Serialize symbolic values (#103273)
* Modified the SymInt schema to also store the hint of the SymInt if it is represented as a symbol so that when we reconstruct the SymInt, the hint will also exist on the node.
* GraphModuleDeserializer.deserialize now also optionally map of symbol names to range.

ReplaceSymSizeOpPass should not be needed after https://github.com/pytorch/pytorch/pull/103107 lands

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103273
Approved by: https://github.com/avikchaudhuri, https://github.com/zhxchen17
2023-06-13 20:29:47 +00:00
e930c0fc35 [export] Initial deserialization v2 (#102716)
v2 of https://github.com/pytorch/pytorch/pull/102126. mentally stacked on top of https://github.com/pytorch/pytorch/pull/102707

Pull Request resolved: https://github.com/pytorch/pytorch/pull/102716
Approved by: https://github.com/avikchaudhuri, https://github.com/zhxchen17
2023-06-07 16:02:35 +00:00
3a385656b5 [export] Initial serialization v2 (#102707)
v2 of https://github.com/pytorch/pytorch/pull/102125 because of git issues
corresponding deserialization diff: https://github.com/pytorch/pytorch/pull/102716

Implementing serialization of the exported program to a python dataclass, and then from that dataclass to json. This is split into a couple of sections:
- `serialize(ep: ep.ExportedProgram, opset_version: Dict[str, int]) -> Tuple[bytes, bytes]` -- takes an exported program object, a dictionary mapping opset namespaces to versions, and returns the serialized exported program in bytes, and separately the state dict serialized in bytes
- `GraphModuleSerializer` class that serializes torch.fx.GraphModule
to the schema.GraphModule dataclass
- `ExportedProgramSerializer` class that serializes torch._export.exported_program.ExportedProgram to the schema.ExportedProgram dataclass

Serialization TODOs:
- [x] pytree spec: https://github.com/pytorch/pytorch/pull/102577
- [ ] higher order ops
- [ ] node metadata (specifically nn_module_stack/source_fn)
- [ ] constraints
- [ ] graph module metadata

The tests are not super comprehensive, but that's because I think it'll be better tested + easier to test once deserialization is implemented.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/102707
Approved by: https://github.com/avikchaudhuri, https://github.com/zhxchen17
2023-06-06 05:12:49 +00:00
c4028de462 [export] ExportedProgram (#102259)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102259
Approved by: https://github.com/ydwu4, https://github.com/avikchaudhuri, https://github.com/tugsbayasgalan, https://github.com/zhxchen17
2023-05-26 23:36:38 +00:00
351c2ea2fb [export] Prototype on serialization schema. (#101899)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/101899
Approved by: https://github.com/angelayi
2023-05-21 06:31:53 +00:00
ba47a2b227 [export] Pickle of ExportGraphModule (#100924)
try 2 of reland of https://github.com/pytorch/pytorch/pull/100620 bc merge conflict 😭...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100924
Approved by: https://github.com/tugsbayasgalan
2023-05-09 16:58:24 +00:00
f42eae4755 Revert "[export] Pickle of ExportGraphModule (#100620)"
This reverts commit d4975a5fe0b263087c8f060409a9331a1dbdde76.

Reverted https://github.com/pytorch/pytorch/pull/100620 on behalf of https://github.com/clee2000 due to broke export/test_serialize.py::TestSerialize::test_pickle_dynamic across various jobs d4975a5fe0, i think you hit another landrace? ([comment](https://github.com/pytorch/pytorch/pull/100620#issuecomment-1536643519))
2023-05-05 18:52:48 +00:00
d4975a5fe0 [export] Pickle of ExportGraphModule (#100620)
reland of https://github.com/pytorch/pytorch/pull/100423 bc merge conflict...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100620
Approved by: https://github.com/mergennachin
2023-05-05 18:21:39 +00:00
c4fd76e7b4 Revert "[export] Pickle result of export (#100423)"
This reverts commit 7226dbcbce87464fb170019a6ffeb80f82c37804.

Reverted https://github.com/pytorch/pytorch/pull/100423 on behalf of https://github.com/angelayi due to merge conflict ([comment](https://github.com/pytorch/pytorch/pull/100423#issuecomment-1534163373))
2023-05-04 06:41:06 +00:00
7226dbcbce [export] Pickle result of export (#100423)
Pickles the metadata["val"] into TensorMetadata struct so that it'll be retrained when we unpickle.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100423
Approved by: https://github.com/mergennachin
2023-05-04 06:37:16 +00:00