audio icon indicating copy to clipboard operation
audio copied to clipboard

Use non-persistent buffers

Open Thylane opened this issue 2 years ago • 6 comments

🚀 The feature

Suggest using register_buffer() with persistent=False, so the buffer (e.g. window of spectrogram) will not be included in module's state dict.

Motivation, pitch

When I add new transforms to my model and load a pre-existing checkpoint, a missing key error will be raised, e.g. missing resample kernel in transforms.Resample. It can be solved by specifying strict=False at load time, however, I don't see any reason to save the buffers. They can be recomputed on construction time and that won't affect model's behavior.

Alternatives

No response

Additional context

Same motivation as https://github.com/pytorch/pytorch/issues/18056.

Thylane avatar Feb 14 '23 09:02 Thylane

This sounds reasonable to me. @pytorch/team-audio-core any objection?

mthrok avatar Feb 14 '23 19:02 mthrok

The team thinks this is a good change, and we look for contributor to make the change. Feel free to open a PR.

mthrok avatar Feb 21 '23 20:02 mthrok

Hello,

Is anyone working on this? I'm planning to give it a shot and possibly submit a PR.

ashikshafi08 avatar May 02 '23 15:05 ashikshafi08

HIi @ashikshafi08

Thanks for the interest. No one is working on it, so feel free to do so.

mthrok avatar May 02 '23 20:05 mthrok

@mthrok I don’t see recent updates on this issue. I can take a look at this issue if there are no conflicts with others?

francislata avatar Nov 06 '23 02:11 francislata

@mthrok I don’t see recent updates on this issue. I can take a look at this issue if there are no conflicts with others?

@francislata Thanks for the suggestion. I don't think anyone is working on it, so feel free to send a PR.

mthrok avatar Nov 07 '23 01:11 mthrok