✨[Feature] Add pickle_protocol
argument for torch_tensorrt.save
#3294
Labels
feature request
New feature or request
pickle_protocol
argument for torch_tensorrt.save
#3294
Is your feature request related to a problem? Please describe.
I am trying to save an optimized CLIP model to the disk, but it's too large (around 8 Gb if I remember correctly) for pickle to handle with pickle_protocol < 4 (which is what is used by default) - it gives
OverflowError: serializing a string larger than 4 GiB requires pickle protocol 4 or higher
Describe the solution you'd like
It would be great if you could add
pickle_protocol
argument totorch_tensorrt.save
method, similar to howtorch.save
does it, so it would be possible to save large optimized modelsDescribe alternatives you've considered
I've tried
torch.save
, but it does not save all of the required information about the optimized model, so it yields the following error when I domodel = torch.export.load(model_path).module()
:Additional context
MRE (requires
pip install torch torch_tensorrt open_clip
):Running the above script gives the following result:
By default, torch uses pickle protocol 2 as per this line
The text was updated successfully, but these errors were encountered: