TMElyralab / MuseTalk

MuseTalk: Real-Time High Quality Lip Synchorization with Latent Space Inpainting
Other
1.85k stars 223 forks source link

关于实时性的一些讨论 #33

Open swx3027925806 opened 2 months ago

swx3027925806 commented 2 months ago

你好,在我们的的部署中发现一个问题,即在VAE的模型中,将GPU上的数据拷贝到CPU上花费了巨量的时间。简单来说就是在不考虑这一步的情况下,实时性可以达到60+的fps。但是因为它的存在导致我们的性能只能在30fps左右。请问有没有什么办法在这个基础上做到优化呢?这是因为显卡位宽所导致的吗?我们的实验环境是4090。

itechmusic commented 2 months ago

即在VAE的模型中,将GPU上的数据拷贝到CPU上花费了巨量的时间

“即在VAE的模型中,将GPU上的数据拷贝到CPU上花费了巨量的时间” 请问这句话是指vae decode的结果从GPU到CPU吗?

swx3027925806 commented 2 months ago

是的

swx3027925806 commented 2 months ago

具体体现在如下代码是:

    def decode_latents(self, latents):
        """
        Decode latent variables back into an image.
        :param latents: The latent variables to decode.
        :return: A NumPy array representing the decoded image.
        """
        latents = (1/  self.scaling_factor) * latents
        image = self.vae.decode(latents.to(self.vae.dtype)).sample
        image = (image / 2 + 0.5).clamp(0, 1)
        # 在这里的.cpu()上
        image = image.detach().cpu().permute(0, 2, 3, 1).float().numpy()
        image = (image * 255).round().astype("uint8")
        image = image[...,::-1] # RGB to BGR
        return image
itechmusic commented 2 months ago

我们测了一下好像这一步没有特别慢,请问你有你那边的测速数据吗?

jinqinn commented 2 months ago

@itechmusic realtime-inference支持了图片的实时推理,但不支持音频流失输入,因musetalk引用了whisper组件,该组件好像不支持音频流失推理,请教下要如何进行调优呢?

hihowie commented 1 month ago

这个时间不是拷贝数据到cpu的时间,是因为gpu运算还未结束,会一直阻塞,所以看起来拷贝时间很久

jinqinn commented 1 month ago

话说这个项目是不是没了,没更新了

czk32611 commented 2 weeks ago

@itechmusic realtime-inference支持了图片的实时推理,但不支持音频流失输入,因musetalk引用了whisper组件,该组件好像不支持音频流失推理,请教下要如何进行调优呢?

不好意思,音频的流式处理我们暂时没有研究。