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

Optimize for inference when using call api #162

Merged
merged 2 commits into from
Feb 19, 2024
Merged

Conversation

joeyballentine
Copy link
Member

Generally speaking, it's always good to put a model in inference mode when performing inference. I figure it's probably good to do this automatically when using the call api to prevent possible problems.

Could theoretically be related to #160 but I think they are doing the right things there so I don't think tat's it

@RunDevelopment
Copy link
Member

Can @torch.inference_mode() and model.eval() negatively affect performance if the model already under inference mode?

@joeyballentine
Copy link
Member Author

I haven't tested it, but I don't believe so.

For the record, I'm pretty sure we call that multiple times in chaiNNer. And the inference mode thing is meant to be used individually each time the model is ran. Check the docs.

@joeyballentine joeyballentine merged commit 4e647a7 into main Feb 19, 2024
7 checks passed
@joeyballentine joeyballentine deleted the optimize-inference branch February 19, 2024 20:00
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 this pull request may close these issues.

2 participants