Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add the ability of lru cache for api v3 to improve the inference speed when exchange model weights #1058

Merged

Conversation

KevinZhang19870314
Copy link

@RVC-Boss
Copy link
Owner

RVC-Boss commented May 8, 2024

@ChasonJiang 来审阅下,没问题就合了

@ChasonJiang
Copy link

ChasonJiang commented May 8, 2024

@KevinZhang19870314 没有没试过,会不会爆显存?看起来似乎没有将weight移到内存。(在tts完之后

@ChasonJiang
Copy link

@KevinZhang19870314 没有没试过,会不会爆显存?看起来似乎没有将weight移到内存。(在tts完之后

可以用TTS.set_device(),在合成完之后移到cpu,要用的时候再移到gpu

@KevinZhang19870314
Copy link
Author

KevinZhang19870314 commented May 9, 2024

@KevinZhang19870314 没有没试过,会不会爆显存?看起来似乎没有将weight移到内存。(在tts完之后

可以用TTS.set_device(),在合成完之后移到cpu,要用的时候再移到gpu

@ChasonJiang 你好,我对PyTorch实在不熟悉,按照review的提示,我修改了一版,麻烦有空看一下(或者不对也可以修改一版?)。

另外我这边暂时没有显卡设备,所以也没法测试,只在CPU机器上面测试没问题。

api_v3.py Outdated
print("Moved TTS models to CPU to save GPU memory.")


def move_to_gpu(tts):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样改会不会好一些

def move_to_gpu(tts:TTS, tts_config:TTS_Config):
    tts.set_device(tts_config.device)
    print("Moved TTS models back to GPU for performance.")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没太明白,你的意思是说合并两个方法为一个吗?

def move_to_device(tts, tts_config)

合成完之后移到cpu,要用的时候再移到gpu

按照你之前说的在合成前后是要指定cpu或者gpu的话,按照这个方法签名如何指定?保存到tts_config里面去然后传入吗?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没太明白,你的意思是说合并两个方法为一个吗?

我的意思是把move_to_gpu()改为我写的那样,这样在设置推理设备的时候就和yaml里的推理设备保持一致了

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChasonJiang Done.

@RVC-Boss RVC-Boss merged commit 50c3664 into RVC-Boss:fast_inference_ May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants