-
-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug 🐞
Iterating over a DataLoader is still broken on 4.0.3. If epochs is less than the number of elements in DataLoader, only the first epochs elements get evaluated.
Expected behavior
Surely this should iterate over the entire dataset epochs times
Minimal Reproducible Example 👇
function lossf(θ, data)
@show data
return sum(θ.^2)
end
dataloader = DataLoader(collect(1:10), batchsize = 1)
opt_func = OptimizationFunction(
lossf,
Optimization.AutoZygote())
opt_prob = OptimizationProblem(opt_func, [2.0], dataloader)
res_adam = solve(
opt_prob, Optimisers.Adam(0.001); epochs = 3)
Error & Stacktrace
No stacktrace, but julia outputs this:
data = [1]
data = [2]
data = [3]
data = [3]
data = [1]
data = [2]
data = [3]
data = [3]
data = [1]
data = [2]
data = [3]
data = [3]
retcode: Default
u: 1-element Vector{Float64}:
1.9940003690339771Environment (please complete the following information):
Latest versions of Optimization and OptimizationOptimisers
Additional context
The problem is in this line:
| if i == maxiters #Last iter, revert to best. |
Probably the if condition should be something like
epoch == maxiters && i == length(data). It would also be good to add a test.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working