Open ElOceanografo opened 4 years ago
A cheap workaround would be to disable logging of such messages globally by setting
import Logging
Logging.disable_logging(Logging.Warn) # or e.g. Logging.Info
Alternatively, you can use a local logger for your sample
call:
import Logging
logger = Logging.SimpleLogger(min_level=Logging.Error) # or e.g. Logging.Warn
chain = Logging.with_logger(logger) do
sample(...)
end
The logging system is explained in more detail in the Julia docs.
A disadvantage of these approaches would be that progress bars are not displayed IIRC.
This should probably be handled upstream in AdvancedHMC, since the warning doesn't respect verbose
:
Yes, I agree. The approaches above are just workarounds as long as it is not fixed upstream.
Yeah, it's a good thing to have the workaround on record.
Thanks, that workaround will be very helpful. I'm fitting a large number of models, and while the first few "step size found" notifications are useful, they get less interesting after the 30 or 40 thousandth 🙃
The local logger code from David didn't work for me. Instead, on Julia 1.6, use
stream = IOBuffer(UInt8[])
logger = Logging.SimpleLogger(stream, Logging.Error)
chain = Logging.with_logger(logger) do
sample(...)
end
In Julia 1.7, you can drop the stream
argument thanks to https://github.com/JuliaLang/julia/pull/40423.
This appears to be a serious issue when using Turing inside a Pluto notebook, as a large number of warnings makes the page unresponsive and I can't even hit the interrupt button.
Currently, sampling from a model always prints warnings for numerical errors and info statements on the initial step size, even with the option
verbose=false
. This can really fill up the REPL, especially when a model run generates frequent numerical errors, or when fitting models to multiple datasets in parallel. Would it be possible to optionally suppress these messages too?