BSON.jl icon indicating copy to clipboard operation
BSON.jl copied to clipboard

Can't load binary when not working in Main

Open DhairyaLGandhi opened this issue 4 years ago • 1 comments

MWE

This works since its applied in the context of Main.

using Flux, BSON
m = Chain(Dense(3,3), Dense(3,3), softmax)
BSON.@save "mwe.bson" m
const m = BSON.@load("mwe.bson")

Now replace this with a non-Main context.

module MWE

using Flux, BSON
# m = Chain(Dense(3,3), Dense(3,3), softmax)
# BSON.@save "mwe.bson" m
const m = BSON.@load("mwe.bson")

end

ref #91

DhairyaLGandhi avatar May 06 '21 12:05 DhairyaLGandhi

Adding discussion from the bi-weekly call. Solution here is to add module (@__MODULE__ by default?) when using the @load macro.

darsnack avatar May 06 '21 16:05 darsnack