将 Julia 连接到权重和对 Python 的偏见
我正在尝试对用 Julia 编写的模型使用权重和偏差。我正在使用 WeightsAndBiasLogger.jl
并尝试测试他们的演示代码:
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
我收到一个错误:“ArgumentError:NULL PyObject的引用”(考虑行:logger = WBLogger(项目=“样本项目”) )
然后我尝试使用以下命令修复此问题:
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
它创建了 logger
对象,但现在错误是:
MethodError: no method matches config!(::PyObject, ::NamedTuple{ (:n_epochs, :lr), 元组{Int64, Float64}}) 最接近的候选者是: config!(!Matched::WBLogger, ::Any; kwargs...) (这考虑行: config!()...
那么,有人知道如何解决这个问题吗?显然,我对 Julia 很陌生,因此如果问一些非常愚蠢的问题,我深表歉意。此外,如果您知道将 Julia 集成到 W&B 中的更好解决方案或任何好的替代方案,我会很高兴听到它
。 1.7.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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论