How to suppress printing of Flux.@epochs?

Flux.@epochs prints out lots of info. How do I suppress its input totally? Current Suppressor.jl doesn’t work on v1.0.x so can’t use that.

MWE

using Flux
model = Flux.Chain(
  Dense(14*16+4, 128, relu),    
  Dense(128, 64, relu),    
  Dense(64, 32, relu),
  Dense(32, 16, relu),
  Dense(16, 1, relu));
loss(x,y) = sum((model(x) .- y).^2)
opt = ADAM(params(model))

x = rand(Bool, 14*16+4)
y = 100
Flux.@epochs 100 Flux.train!(loss, [(x,y)], opt)

If you don’t want the info you can just write for i = 1:100 ...

1 Like

@epochs just expands to a for loop with some extra printing:

macro epochs(n, ex)
  :(@progress for i = 1:$(esc(n))
      @info "Epoch $i"
      $(esc(ex))
    end)
end

So if you don’t want that, just use for.

3 Likes

Ok. Thats what i did in the end. Somehow epoch macro feels fasfer. Even thought it shouldnt