Skip to content

πŸ› [Bug] MutableTorchTensorRTModule.save error out in low_vram_modeΒ #3821

@lanluo-nvidia

Description

@lanluo-nvidia

Bug Description

python examples/apps/flux_demo.py --dtype fp16 --low_vram_mode --load_or_save save

WARNING:torch_tensorrt.dynamo.runtime._MutableTorchTensorRTModule:Trying to move the original PyTorch model. This will cause CPU offloading failing and increase GPU memory usage.If this is absolute necessary, please call module.pytorch_model.to(...)
The model is still on the original device.
Traceback (most recent call last):
File "C:\Users\local-lanl\git\py310\TensorRT\examples\apps\flux_demo.py", line 319, in
main(args)
File "C:\Users\local-lanl\git\py310\TensorRT\examples\apps\flux_demo.py", line 270, in main
torch_tensorrt.MutableTorchTensorRTModule.save(trt_gm, "mutable_trt_gm.pkl")
File "C:\Users\local-lanl\git\venv_py310\lib\site-packages\torch_tensorrt\dynamo\runtime_MutableTorchTensorRTModule.py", line 709, in save
torch.save(module, path, pickle_protocol=4)
File "C:\Users\local-lanl\git\venv_py310\lib\site-packages\torch\serialization.py", line 967, in save
_save(
File "C:\Users\local-lanl\git\venv_py310\lib\site-packages\torch\serialization.py", line 1213, in _save
pickler.dump(obj)
MemoryError

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • Torch-TensorRT Version (e.g. 1.0.0):
  • PyTorch Version (e.g. 1.0):
  • CPU Architecture:
  • OS (e.g., Linux):
  • How you installed PyTorch (conda, pip, libtorch, source):
  • Build command you used (if compiling from source):
  • Are you using local sources or building from archives:
  • Python version:
  • CUDA version:
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions