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

How to clone a SessionBuilder? #70

Closed
murilo-cunha opened this issue Jul 26, 2023 · 0 comments · Fixed by #78
Closed

How to clone a SessionBuilder? #70

murilo-cunha opened this issue Jul 26, 2023 · 0 comments · Fixed by #78
Labels
enhancement New feature or request p: low low priority

Comments

@murilo-cunha
Copy link

murilo-cunha commented Jul 26, 2023

Hi, thanks for this project! I really like the idea of being able to use Rust for ML!

I'm also relatively new to Rust, so I'm not sure if I'm on the wrong track.

I'd like to dynamically change an ONNX model. For that, I have a struct that will include both an onnx_session_builder (SessionBuilder) and an onnx_session (Session). However, when I create a Session from the SessionBuilder, the SessionBuilder gets moved - with_model_downloaded, with_model_from_file, etc. takes self.

I've tried cloning, Rc, RefCell, or even Box and a combination of them with no success.

Is there a way to make a copy of a SessionBuilder so I can recreate and replace a Session?

Edit:

I was able to make it work by putting the crate as a local dependency and adding the#[derive(Clone)] on SessionBuilder. Are there any reasons not to do this that I'm missing?

@decahedron1 decahedron1 moved this to Todo in ort v2.0 Aug 5, 2023
@decahedron1 decahedron1 moved this from Todo to Done in ort v2.0 Aug 5, 2023
@decahedron1 decahedron1 mentioned this issue Aug 16, 2023
Merged
8 tasks
@decahedron1 decahedron1 linked a pull request Aug 20, 2023 that will close this issue
Merged
8 tasks
@decahedron1 decahedron1 added enhancement New feature or request p: low low priority labels Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p: low low priority
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants