Description
I cloned a repository from GitHub, however a message to install TensorRT came up. After installing TensorRT, I received the following error:
PyCUDA ERROR: The context stack was not empty upon module cleanup.
A context was still active when the context stack was being
cleaned up. At this point in our execution, CUDA may already
have been deinitialized, so there is no way we can finish
cleanly. The program will be aborted now.
Use Context.pop() to avoid this problem.
How do I resolve this issue?
Environment
TensorRT Version: 10.2.0.19:
GPU Type: RTX 4060:
Nvidia Driver Version: 560.70:
CUDA Version: 11.8:
CUDNN Version: 9.1:
Operating System + Version: Windows 11:
Python Version (if applicable): 3.10:
TensorFlow Version (if applicable): NA:
PyTorch Version (if applicable): 2.3.0:
Baremetal or Container (if container which image + tag):
Relevant Files
Here is the GitHub: GitHub - aihacker111/Efficient-Live-Portrait: Fast running Live Portrait with TensorRT and ONNX models
Script:
Efficient_Live_Portrait_Tutorial_back.zip (7.9 KB)
Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)
Steps To Reproduce
git clone GitHub - aihacker111/Efficient-Live-Portrait: Fast running Live Portrait with TensorRT and ONNX models
create env using conda
conda create -n ELivePortrait python==3.10.14
conda activate ELivePortrait
install dependencies with GPU
pip install -r requirements-gpu.txt
Run:
python run_live_portrait.py --driving_video ‘D:\Live_Portrait\Efficient-Live-Portrait\experiment_examples\examples\driving\Blow2.mp4’ --source_image ‘D:\Live_Portrait\Efficient-Live-Portrait\experiment_examples\examples\driving\Mila.png’ --run_time --use_face_id
Issue:
File “D:\Live_Portrait\Efficient-Live-Portrait\run_live_portrait.py”, line 41, in
main(args.driving_video, args.source_image, args.source_video, args.condition_image, args.max_faces, args.run_time, args.task, args.half_precision, args.use_face_id, args.cropping_video, args.get_source_audio)
File “D:\Live_Portrait\Efficient-Live-Portrait\run_live_portrait.py”, line 17, in main
live_portrait = EfficientLivePortrait(use_tensorrt, half_precision, cropping_video, **kwargs)
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\fast_live_portrait_pipeline.py”, line 15, in init
super().init(use_tensorrt, half, **kwargs)
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\live_portrait\portrait.py”, line 16, in init
self.predictor = EfficientLivePortraitPredictor(use_tensorrt, half, **kwargs)
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\commons\predictor.py”, line 16, in init
self.trt_engine = TensorRTEngine(self.half, **kwargs)
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\commons\utils\tensorrt_driver.py”, line 89, in init
self.load_plugins(TRT_LOGGER)
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\commons\utils\tensorrt_driver.py”, line 100, in load_plugins
ctypes.CDLL(self.plugin_path, mode=ctypes.RTLD_GLOBAL)
File “C:\Users\sejal\AppData\Local\Programs\Miniconda3\envs\Live_Portrait_2\lib\ctypes_init_.py”, line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Exception ignored in: <function TensorRTEngine.del at 0x0000023FEB4F3AC0>
Traceback (most recent call last):
File “D:\Live_Portrait\Efficient-Live-Portrait\LivePortrait\commons\utils\tensorrt_driver.py”, line 216, in del
del self.engines
AttributeError: engines
PyCUDA ERROR: The context stack was not empty upon module cleanup.
A context was still active when the context stack was being
cleaned up. At this point in our execution, CUDA may already
have been deinitialized, so there is no way we can finish
cleanly. The program will be aborted now.
Use Context.pop() to avoid this problem.
Hi @sejal.datta ,
I would recommend you raising the request to the respective git hub page.
However to install TRT, can you please confirm if you have used the link