Neutone / neutone_sdk

Join the community on Discord for more discussions around Neutone! https://discord.gg/VHSMzb8Wqp
GNU Lesser General Public License v2.1
465 stars 21 forks source link

Fix a bug with deepcopy by saving and reloading model insted #34

Closed bogdanteleaga closed 1 year ago

bogdanteleaga commented 1 year ago

We found out that deepcopy sometimes breaks models in unexpected ways, so this is a workaround fix that should achieve the same result. But I don't think it's ideal, let me know if you have any better ideas @christhetree @hyakuchiki or let's merge it as is.

For example on the DDSP models

(Pdb) sqw.w2w_base.agg_params
tensor([[0.5000],
        [0.5000],
        [0.5000],
        [0.5000]])
(Pdb) script.w2w_base.agg_params
tensor([[0.5000],
        [0.5000],
        [0.5000],
        [0.5000]])
(Pdb) copy.deepcopy(script).w2w_base.agg_params
tensor([0.5000])
christhetree commented 1 year ago

I can't think of a better workaround for now, so fine with me as well.