Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem saving function in BSON #107

Closed
theogf opened this issue Dec 22, 2021 · 5 comments · Fixed by #102
Closed

Problem saving function in BSON #107

theogf opened this issue Dec 22, 2021 · 5 comments · Fixed by #102

Comments

@theogf
Copy link

theogf commented Dec 22, 2021

Here is my MWE:

save("blah.bson", Dict(:f => f->abs(f)))
Fatal error:
ERROR: type DataType has no field ninitialized

That's with julia 1.7.0, BSON 0.3.4, FileIO 1.11.2 on linux x64

@theogf
Copy link
Author

theogf commented Dec 23, 2021

Here are some more tries. It seems to affect only lambda functions:

save("blah.bson", Dict(:f => abs))
# Works
foo(x) = abs(x)
save("blah.bson", Dict(:f => foo))
# Works
save("blah.bson", Dict(:f => x->abs(x))
# Fails with error above

@darsnack
Copy link
Contributor

This is fixed in #102, but we have not merged yet since we want to do away with calling Julia's C internals.

@FishAres
Copy link

How much trouble would it be to merge #102 before removing the C internals? I feel a lot of people doing ML are using 1.7 now (iinm newer Zygote versions require 1.7), and it would be great to be able to save Flux models with arbtirary functions in them using BSON.@save again!

@darsnack
Copy link
Contributor

I'll take a look later this week at the PR. I agree it would be better to get something working before tackling a more ambitious revision.

@austinbean
Copy link

I have also hit this problem. My use case is:

using Metalhead, Flux
using BSON: @save
m = ResNet50()
@save "model.bson" m
ERROR: type DataType has no field ninitialized ... etc.

Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin21.2.0)
CPU: Apple M1 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

BSON v0.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants