JuliaDebug/Infiltrator.jl

Listing only the selected @locals

fpartl opened this issue · 3 comments

Lets say some desperate imaginary programmer (me) is trying to debug his Flux.jl deep learning model. He places the @infiltrate macro in the training loop to, for example, determine only the size of the input data. But since the local environment contains a large model, a loaded data (Flux.DataLoader instance), model parameters, etc., it can take over a minute to run the @locals macro.

It would be very helpful to dump only the selected local variables. Alternatively, list only the type of variables.

For this dummy function:

function model_test(model::VAE, device, loader, β::AbstractFloat)
    for seq  loader
        x = seq[begin]; y = seq[end]

        @infiltrate
        μ, logσ, ŷ = model(x |> device)
        break
    end
end

@locals macro after some time gives
obrazek
which is absolutely excellent, but the evaluation takes a long time and much of it is not interesting at the moment. So something like @locals seq y would be great! The output would look like the following.
image832

Or did I miss something? In either case, thank you for your great work.

I've implemented that in #68, but note that you can just enter seq or y in the prompt to inspect them.

Wow! What a speed! Thank you! 👍 When should I expect a new release?

As soon as GH actions (and therefore registry auto-merge) work again (check https://www.githubstatus.com/).