-
Notifications
You must be signed in to change notification settings - Fork 51
removed platform sdk dependency #540
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide a full description of the significance/purpose of this PR.
Signed-off-by: Sharvari Medhe <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test this on a system where apps sdk is not installed the expected behaviour is
if sdk is not installed , qeff works till export, and fails at compile, execute
if QAICInferenceSession._qaicrt is None: | ||
try: | ||
QAICInferenceSession._qaicrt = importlib.import_module("qaicrt") | ||
except ImportError: | ||
sys.path.append(f"/opt/qti-aic/dev/lib/{platform.machine()}") | ||
QAICInferenceSession._qaicrt = importlib.import_module("qaicrt") | ||
return QAICInferenceSession._qaicrt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not required to check if the model is already loaded or not.
Python automatically does this.
https://stackoverflow.com/questions/19077381/what-happens-when-a-module-is-imported-twice#:~:text=Nothing%2C%20if%20a%20module%20has,modules%20).
if QAICInferenceSession._aicapi is None: | ||
try: | ||
QAICInferenceSession._aicapi = importlib.import_module("QAicApi_pb2") | ||
except ImportError: | ||
sys.path.append("/opt/qti-aic/dev/python") | ||
QAICInferenceSession._aicapi = importlib.import_module("QAicApi_pb2") | ||
return QAICInferenceSession._aicapi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
_qaicrt = None | ||
_aicapi = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good practice to have a module as a class variable. When you remove the dependency of checking if the module in already imported, this is not required.
This PR updates QEff to support QPC generation on systems without the Platform SDK by refactoring the module loading behavior. Users can now compile models and generate QPCs using QEff with only the Apps SDK installed.
Background: Previously, both Apps SDK and Platform SDK were required to compile and generate QPCs using QEff. The goal is to allow QPC generation with only the Apps SDK installed for systems without Ultra cards.
Changes:
Refactored init.py and generation/cloud_infer.py to use lazy loading via importlib for qaicrt and aicapi.
This ensures that Platform SDK-dependent modules are only loaded when explicitly needed, avoiding import errors during initialization and QPC generation.