You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I originally noticed the issue here, FluxML/model-zoo#383. It seems to be a Zygote issue, so I have created a dedicated issue here for a better traceability.
In the following MWE, loss_slow compiles at every iteration. Additionally, the runtime and the memory usage at each iteration are increasing. It looks like loss_slow causes Zygote to continuously accumulate some data. In the vae_mnist example, the runtime starts at 4 minutes/epoch and reaches 1.5 hours per epoch.
The equivalent loss_explicit function behaves as expected.
using Flux
using Flux: norm
model = Dense(2, 2)
loss_slow(m) = sum(p->norm(p), Flux.params(m))
loss_explicit(m) = norm(m.weight) + norm(m.bias)
for i in 1:10
@time ∇m_slow = gradient(m->loss_slow(m), model)
end
for i in 1:10
@time ∇m_explicit = gradient(m->loss_explicit(m), model)
end
If an issue can't be reproduced without Flux, it's probably a Flux issue ;). Do you have a Flux-free MWE? If not, then it'd be better to reopen FluxML/Flux.jl#2040 and add your comment to that thread.
I originally noticed the issue here, FluxML/model-zoo#383. It seems to be a Zygote issue, so I have created a dedicated issue here for a better traceability.
In the following MWE,
loss_slow
compiles at every iteration. Additionally, the runtime and the memory usage at each iteration are increasing. It looks likeloss_slow
causes Zygote to continuously accumulate some data. In the vae_mnist example, the runtime starts at 4 minutes/epoch and reaches 1.5 hours per epoch.The equivalent
loss_explicit
function behaves as expected.Here is the output:
The text was updated successfully, but these errors were encountered: