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