2

I am trying to use weights&biases for my models written in Julia. I am using WeightsAndBiasLogger.jl and try to test their demo code:

using Logging, WeightsAndBiasLogger

args = (n_epochs=1_000, lr=1e-3)
logger = WBLogger(project="sample-project")
config!(logger, args)

with(logger) do
    loss = 0
    for i in 1:args.n_epochs
        loss += randn() * args.lr
        @info "train" i=i loss=loss
    end
end

I receive an error: "ArgumentError: ref of NULL PyObject" (considering the line: logger = WBLogger(project="sample-project") )

Then I tried to fix this with the following command:

using Logging, WeightsAndBiasLogger, PyCall

args = (n_epochs=1_000, lr=1e-3)

const logger = PyNULL()
function __init__()
    copy!(logger, WBLogger(project="sample-project"))
end

config!(logger, args)

with(logger) do
    loss = 0
    for i in 1:args.n_epochs
        loss += randn() * args.lr
        @info "train" i=i loss=loss
    end
end

It creates the logger object, but now the error is:

MethodError: no method matching config!(::PyObject, ::NamedTuple{(:n_epochs, :lr), Tuple{Int64, Float64}}) Closest candidates are: config!(!Matched::WBLogger, ::Any; kwargs...) (this consider the line: config!()...

So, does anyone know how to solve the issue? Obviously, I am new to Julia, thus I apologize if asking something very stupid. In addition, if you know a better solution to integrate Julia into W&B or any good alternatives, I would be glad to hear it.

PS: Julia ver 1.7.2

Bloxx
  • 1,495
  • 1
  • 9
  • 21
  • 2
    You could try https://github.com/avik-pal/Wandb.jl – Eric Feb 22 '22 at 20:27
  • 1
    Here's some documentation for the above unofficial Julia binding within the W&B docs: https://docs.wandb.ai/guides/integrations/other/w-and-b-for-julia – Scott Condron Feb 23 '22 at 11:11

0 Answers0