PersonaLive icon indicating copy to clipboard operation
PersonaLive copied to clipboard

tensorrt crash Trying with my 4070ti super 16 GB v-ram

Open verqqa opened this issue 11 months ago • 1 comments

C:\Users\aitotts\Desktop\live personal\PersonaLive-main\inference_online.py:232: DeprecationWarning: on_event is deprecated, use lifespan event handlers instead.

    Read more about it in the
    [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).

@self.app.on_event("shutdown") init done INFO: Started server process [22508] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:7860 (Press CTRL+C to quit) INFO: 127.0.0.1:64369 - "GET / HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/assets/0.5f025b26.css HTTP/1.1" 200 OK INFO: 127.0.0.1:64370 - "GET /_app/immutable/assets/2.4b49e46c.css HTTP/1.1" 200 OK INFO: 127.0.0.1:64370 - "GET /_app/immutable/entry/start.c1379b9e.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/chunks/scheduler.d303939e.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/chunks/singletons.a975f24f.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64370 - "GET /_app/immutable/chunks/index.57cd3851.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/entry/app.39adbfcf.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64370 - "GET /_app/immutable/chunks/index.7990873a.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/nodes/0.2023b177.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64370 - "GET /_app/immutable/nodes/2.b1660819.js HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /favicon.png HTTP/1.1" 200 OK INFO: 127.0.0.1:64369 - "GET /_app/immutable/nodes/1.c762eef1.js HTTP/1.1" 200 OK C:\Users\aitotts\Desktop\live personal\PersonaLive-main\inference_online.py:199: PydanticDeprecatedSince20: The schema method is deprecated; use model_json_schema instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/ info_schema = pipeline.Info.schema() C:\Users\aitotts\Desktop\live personal\PersonaLive-main\inference_online.py:204: PydanticDeprecatedSince20: The schema method is deprecated; use model_json_schema instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/ input_params = pipeline.InputParams.schema() INFO: 127.0.0.1:64370 - "GET /api/settings HTTP/1.1" 200 OK INFO: 127.0.0.1:64456 - "POST /api/upload_reference_image HTTP/1.1" 200 OK C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\diffusers\models\resnet.py:328: FutureWarning: scale is deprecated and will be removed in version 1.0.0. The scale argument is deprecated and will be ignored. Please remove it, as passing it will raise an error in the future. scale should directly be passed while calling the underlying pipeline component i.e., via cross_attention_kwargs. deprecate("scale", "1.0.0", deprecation_message) C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\diffusers\models\downsampling.py:136: FutureWarning: scale is deprecated and will be removed in version 1.0.0. The scale argument is deprecated and will be ignored. Please remove it, as passing it will raise an error in the future. scale should directly be passed while calling the underlying pipeline component i.e., via cross_attention_kwargs. deprecate("scale", "1.0.0", deprecation_message) C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\diffusers\models\upsampling.py:147: FutureWarning: scale is deprecated and will be removed in version 1.0.0. The scale argument is deprecated and will be ignored. Please remove it, as passing it will raise an error in the future. scale should directly be passed while calling the underlying pipeline component i.e., via cross_attention_kwargs. deprecate("scale", "1.0.0", deprecation_message) fuse reference done INFO: 127.0.0.1:64464 - "WebSocket /api/ws/e5b2c6a8-26af-402c-971b-345926786a12" [accepted] User count: 0 New user connected: e5b2c6a8-26af-402c-971b-345926786a12 INFO: connection open C:\Users\aitotts\Desktop\live personal\PersonaLive-main\webcam\util.py:32: UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:212.) tensor = torch.from_numpy(np_img) Process Process-1: Traceback (most recent call last): File "C:\Users\aitotts.conda\envs\PersonaLive\lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Users\aitotts.conda\envs\PersonaLive\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\webcam\vid2vid_trt.py", line 138, in generate_process video = pipeline.process_input(images) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\wrapper_trt.py", line 261, in process_input mot_bbox_param, kps_ref, kps_frame1, kps_dri = self.pose_encoder.interpolate_kps_online(self.ref_cond_tensor, tgt_cond_tensor, num_interp=12+1) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\liveportrait\motion_extractor.py", line 140, in interpolate_kps_online kp1 = self.detector(ref.to(self.dtype)) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\liveportrait\convnextv2.py", line 120, in forward x = self.forward_features(x) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\liveportrait\convnextv2.py", line 116, in forward_features x = self.stagesi File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\container.py", line 215, in forward input = module(input) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\liveportrait\convnextv2.py", line 41, in forward x = self.grn(x) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\aitotts\Desktop\live personal\PersonaLive-main\src\liveportrait\util.py", line 339, in forward Gx = torch.norm(x, p=2, dim=(1, 2), keepdim=True) File "C:\Users\aitotts.conda\envs\PersonaLive\lib\site-packages\torch\functional.py", line 1611, in norm return torch.linalg.vector_norm(input, _p, _dim, keepdim, dtype=dtype) RuntimeError: CUDA error: invalid argument CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

verqqa avatar Dec 30 '25 15:12 verqqa

I managed to get it working on my 4060ti with this change. its super slow and laggy still even though im using tensorRT but at least its working.

in src/liveportrait/util.py:338

def forward(self, x):
        dtype = x.dtype
        x_float = x.float()
        Gx = torch.norm(x_float, p=2, dim=(1, 2), keepdim=True)
        Nx = Gx / (Gx.mean(dim=-1, keepdim=True) + 1e-6)
        Nx = Nx.to(dtype)
        return self.gamma * (x * Nx) + self.beta + x

in src/modeling/engine_model.py:3 add import

import pycuda.autoprimaryctx  # Use primary context for Torch interop.

in src/modeling/engine_model.py:54

class EngineModel:
    def __init__(self, engine_file_path, stream = None, device_int = 0, extra_lock = None):
        self.device_int = device_int
        self.extra_lock = extra_lock
        if not(self.extra_lock is None):
            self.extra_lock.acquire()
        assert os.path.exists(engine_file_path), "Engine model path not exists!"
        self.ctx = cuda.Device(self.device_int).retain_primary_context()
        self.ctx.push()

rex993 avatar Dec 31 '25 22:12 rex993