RVC-Boss / GPT-SoVITS

1 min voice data can also be used to train a good TTS model! (few shot voice cloning)
MIT License
30.01k stars 3.45k forks source link

It seems that the move_to_gpu & move_to_cpu is not working as expected in the branch fast_inference. #1240

Open SetoKaiba opened 1 month ago

SetoKaiba commented 1 month ago

It seems that the move_to_gpu & move_to_cpu is not working as expected in the branch fast_inference.

https://github.com/RVC-Boss/GPT-SoVITS/blob/fast_inference_/api_v3.py#L327-L343

It will always move to cpu. The custom settings device is cuda. The precision is half.

When the move_to_cpu is called, the custom settings device became cpu and the precision kept half. But according to lines below, half is not supported for cpu.

https://github.com/RVC-Boss/GPT-SoVITS/blob/fast_inference_/GPT_SoVITS/TTS_infer_pack/TTS.py#L311-L313

I try to add the lines below to move_to_cpu. https://github.com/RVC-Boss/GPT-SoVITS/blob/fast_inference_/api_v3.py#L348-L351

    tts.enable_half_precision(False)

I try to add the lines below to move_to_gpu. https://github.com/RVC-Boss/GPT-SoVITS/blob/fast_inference_/api_v3.py#L354-L356

    tts.enable_half_precision(tts_config.is_half)

But then the first tts request is working. The second isn't. Here's the error of the second request.

{
    "message": "tts failed",
    "Exception": "Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper_CUDA__index_select)"
}

@KevinZhang19870314

KevinZhang19870314 commented 1 month ago

see 1241

RVC-Boss commented 1 month ago

是不是合并了就解决啦?

SetoKaiba commented 1 month ago

Yes

xiaokang00010 commented 3 weeks ago

@SetoKaiba 当出现并行请求时,仍然会出现这个问题,会被自动更改为CPU推理,不知道为什么。

image

SetoKaiba commented 3 weeks ago

@SetoKaiba 当出现并行请求时,仍然会出现这个问题,会被自动更改为CPU推理,不知道为什么。

image

How to reproduce?

xiaokang00010 commented 2 weeks ago

@SetoKaiba 当出现并行请求时,仍然会出现这个问题,会被自动更改为CPU推理,不知道为什么。 image

How to reproduce?

@SetoKaiba

https://github.com/RVC-Boss/GPT-SoVITS/assets/47490867/89fa3985-c934-4590-9f10-31d97ad497b6

Sorry for delayed response, I just simply send two requests in one go, and the server used cpu infer as fallback.