fish-speech icon indicating copy to clipboard operation
fish-speech copied to clipboard

The GPU memory usage during inference is increasing, the inference speed is getting slower and slower, the cuda usage is decreasing, and the memory is not released

Open renlindadada opened this issue 1 year ago • 9 comments

Self Checks

  • [x] This template is only for bug reports. For questions, please visit Discussions.
  • [x] I have thoroughly reviewed the project documentation (installation, training, inference) but couldn't find information to solve my problem. English 中文 日本語 Portuguese (Brazil)
  • [x] I have searched for existing issues, including closed ones. Search issues
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template and fill in all required fields.

Cloud or Self Hosted

Self Hosted (Source)

Environment Details

Image

Steps to Reproduce

The GPU memory usage during inference is increasing, the inference speed is getting slower and slower, the cuda usage is decreasing, and the memory is not released

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

renlindadada avatar Jun 15 '25 14:06 renlindadada

遇到同样的问题

hemiaolong avatar Jun 18 '25 06:06 hemiaolong

同样的问题

freenowill avatar Jun 20 '25 09:06 freenowill

同样的问题

Surrin1999 avatar Jun 30 '25 06:06 Surrin1999

1.5版本没这个问题,新版本才出现的

best9009 avatar Jul 08 '25 08:07 best9009

same problem. (Ubuntu)

meidongyang avatar Jul 08 '25 09:07 meidongyang

Same.

Am going to attempt to clear the model after every 100 gens, wonder if that will help.

Not sure how an issue this fundamental can go un-responded to for this long.

zeropointnine avatar Jul 11 '25 01:07 zeropointnine

Same.

l294265421 avatar Jul 13 '25 01:07 l294265421

Image

The GPU memory leak issue is caused by the graph construction problem in torch.compile, where each input triggers a new compilation. This is unreasonable and leads to a sharp increase in memory usage with every call.​​

​​Here, 🤪I’ve provided a less elegant solution that resolves the memory issue. After testing 1,000 times, the memory remains stable. Additionally, the latency per call meets expectations, and there are no noticeable quality flaws in the audio output.

fix(inference): GPU memory leakage bug (#1040) #1073

echonoshy avatar Jul 14 '25 08:07 echonoshy

@echonoshy worked like a charm! you nailed it ;)

DynoBytes24 avatar Jul 14 '25 11:07 DynoBytes24