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

Serialization stdlib support? #8

Open
ericphanson opened this issue May 14, 2021 · 0 comments
Open

Serialization stdlib support? #8

ericphanson opened this issue May 14, 2021 · 0 comments

Comments

@ericphanson
Copy link
Collaborator

Currently, I've been using these functions to serialize and deserialize models:

function serialize_model(model)
    # using https://github.com/catboost/catboost/issues/1567#issuecomment-809007736
    return model._serialize_model()
    # using official API:
    # bytes = mktempdir() do tmp
    #     path = joinpath(tmp, "model.cbm")
    #     model.save_model(path; format = "cbm")
    #     return read(path)
    # end
    # return bytes
end

function deserialize_model(bytes)
    return catboost.CatBoost().load_model(; blob=PyCall.pybytes(bytes), format="cbm")
end

I suspect there might be a way to add methods to the Serialization stdlib to do this. That would be useful since it would allow moving models between Julia workers transparently.

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

No branches or pull requests

1 participant