-
Notifications
You must be signed in to change notification settings - Fork 184
Configuring SessionOptions programmatically #1393
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
Comments
We have an env flag that you can enable to get debug logs At the moment, we don't have any mechanism to programmatically control the verbose logging through an API mostly because we see this as an ONNX Runtime specific control to be used only for debugging that can be controlled through the genai_config.json (does not need runtime dependence). But I see that this can be useful. Not sure when we can get to this though. |
Ah, we do have a way to overlay options onto the genai_config.h at runtime through the config.Overlay(json overlay) method, but it's not currently exposed in C#. The way you'd use it for your case would be like this (C++ example): config.Overlay(R"({ "model": { "decoder": { "session_options": { "log_severity_level": 0 } } } })"); Let us know if that is what you need and we'll expose it for C# |
I wasn't aware of this environment variable. Not a big deal, but I notice that it doesn't allow configuring the severity level. It's either verbose or nothing but I'll be sure to use it next time I need this.
This is what I ended up doing though it's not very convenient, particularly when you need to choose from different models at runtime. It entails editing the
My immediate need could be resolved with the Having said that, if I had the choice, I would prefer setting the value for individual options rather than building a JSON string. For example:
Or even better, having strongly typed properties exposed by the Config object.
Thanks @baijumeswani and @RyanUnderhill! |
Yes, for things that we learn are popular we can always add specific APIs for them. But for models with multiple sessions, you can set the options per model (encoder model having different options than the decoder model). So some are hard to add just one single API for. |
Yes, I understand. I did find a need to be able to determine |
I needed to enable verbose logging to troubleshoot an issue I was having. As far as I know, this is done by configuring the
LogSeverityLevel
property of theSessionOptions
.I'm currently using Microsoft.Extensions.AI and the
OnnxRuntimeGenAIChatClient
. The only mechanism to configure the execution environment that appears to be currently available is to create aConfig
object and use it to construct aModel
, which is then used to initialize the client. However, even though theConfig
class has aSetProviderOption
method, it seems to be missing aSetOption
method.For example:
I'm aware that you can do this by setting the property in
genai_config.json
, but there seems to be missing a mechanism to do this programmatically.The text was updated successfully, but these errors were encountered: