Skip to content

Commit

Permalink
updates from PR review, improved multimodel layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Colangelo committed Jan 23, 2025
1 parent 06a3467 commit a29f3a0
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 86 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SPDX-License-Identifier: Apache-2.0

DigestAI
===========================

<h3>DigestAI is a powerful model analysis tool that extracts insights from your models, enabling optimization and direct modification.</h3>

[![python](https://img.shields.io/badge/python-3.10-blue)](https://github.com/onnx/digestai)
Expand All @@ -16,11 +17,12 @@ DigestAI

![logo](src/digest/assets/images/banner.png)
---

<div align="left">

DigestAI is a powerful model analysis tool that extracts insights from your models, enabling optimization and direct modification.

**Get started quickly!** Download the DigestAI installer directly from [link to download page].
**Get started quickly!** Download the DigestAI executable directly from [link coming soon].

**Developers: Contribute to DigestAI** Follow the installation instruction below to get started.

Expand Down Expand Up @@ -65,19 +67,18 @@ The following steps are recommended because they are reproducible, however, ther
**Workflow**

1. **Open Qt Designer:**
- **Activate Conda Environment:** Ensure your `digest` Conda environment is activated.
- **Launch:** Run `pyside6-designer.exe` from your terminal.
* **Activate Conda Environment:** Ensure your `digest` Conda environment is activated.
* **Launch:** Run `pyside6-designer.exe` from your terminal.

2. **Work with UI Files:**
- Open any existing UI file (`.ui`) from `src/digest/ui`.
- Design your interface using the drag-and-drop tools and property editor.
- Resource Files (Optional): If your UI uses custom icons, images, or stylesheets, please leverage the Qt resource file (`.qrc`). This makes it easier to manage and package resources with the application.
- Please add any new `.ui` files to the `.pylintrc` file.
* Open any existing UI file (`.ui`) from `src/digest/ui`.
* Design your interface using the drag-and-drop tools and property editor.
* Resource Files (Optional): If your UI uses custom icons, images, or stylesheets, please leverage the Qt resource file (`.qrc`). This makes it easier to manage and package resources with the application.
* Please add any new `.ui` files to the `.pylintrc` file.

3. **Recompile UI Files (After Making Changes):**
- From your terminal, navigate to the project's root directory.
- Run: `python src/digest/compile_digest_gui.py`
* From your terminal, navigate to the project's root directory.
* Run: `python src/digest/compile_digest_gui.py`
## Building EXE for Windows Deployment
Expand Down Expand Up @@ -114,8 +115,9 @@ pytest test/test_gui.py
```
## License
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE.txt) file for details.
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE.txt) file for details.
## Copyright
Copyright(C) 2024 Advanced Micro Devices, Inc. All rights reserved.
Copyright(C) 2024 Advanced Micro Devices, Inc. All rights reserved.
2 changes: 1 addition & 1 deletion src/digest/gui_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# For EXE releases we can block certain features e.g. to customers

modules:
huggingface: true
huggingface: false
7 changes: 3 additions & 4 deletions src/digest/model_class/digest_report_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,15 @@ def __init__(

def parse_model_nodes(self) -> None:
"""There are no model nodes to parse"""
return

def save_yaml_report(self, filepath: str) -> None:
"""Report models are not intended to be saved"""
return

def save_text_report(self, filepath: str) -> None:
"""Report models are not intended to be saved"""
return


def validate_yaml(report_file_path: str) -> bool:
Expand Down Expand Up @@ -231,10 +234,6 @@ def compare_dicts(
differences = compare_dicts(yaml1, yaml2)

if differences:
# print("Differences found:")
# for diff in differences:
# print(f"- {diff}")
return False
else:
# print("No differences found.")
return True
12 changes: 8 additions & 4 deletions src/digest/multi_model_selection_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ def __init__(
self.ui.radioONNX.toggled.connect(self.update_list_view_items)
self.ui.radioReports.toggled.connect(self.update_list_view_items)
self.ui.selectFolderBtn.clicked.connect(self.openFolder)

# We want to retain the size when the duplicate label
# is hidden to keep the two list columns even.
policy = self.ui.duplicateLabel.sizePolicy()
policy.setRetainSizeWhenHidden(True)
self.ui.duplicateLabel.setSizePolicy(policy)
self.ui.duplicateLabel.hide()

self.ui.modelListView.setModel(self.item_model)
self.ui.modelListView.setContextMenuPolicy(
Qt.ContextMenuPolicy.CustomContextMenu
Expand Down Expand Up @@ -324,10 +331,7 @@ def set_directory(self, directory: str):
progress.close()

if num_duplicates:
label_text = (
f"The following {num_duplicates} models were found to be "
"duplicates and have been deselected from the list on the left."
)
label_text = f"Ignoring {num_duplicates} duplicate model(s)."
self.ui.duplicateLabel.setText(label_text)
self.ui.duplicateLabel.show()
else:
Expand Down
99 changes: 60 additions & 39 deletions src/digest/ui/multimodelselection_page.ui
Original file line number Diff line number Diff line change
Expand Up @@ -218,31 +218,6 @@
</property>
</widget>
</item>
<item alignment="">
<widget class="QLabel" name="duplicateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>550</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>The following models were found to be duplicates and have been deselected from the list on the left.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
Expand All @@ -258,25 +233,43 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="numSelectedLabel">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>0 selected models</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="columnsLayout">
<item>
<layout class="QVBoxLayout" name="leftColumnLayout">
<item>
<widget class="QLabel" name="numSelectedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>0 selected models</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="modelListView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
Expand All @@ -295,10 +288,38 @@
</item>
<item>
<layout class="QVBoxLayout" name="rightColumnLayout">
<item>
<widget class="QLabel" name="duplicateLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Ignoring 0 duplicate model(s).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="duplicateListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down
57 changes: 33 additions & 24 deletions src/digest/ui/multimodelselection_page_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,37 @@ def setupUi(self, MultiModelSelection):

self.horizontalLayout_3.addWidget(self.radioReports)

self.duplicateLabel = QLabel(MultiModelSelection)
self.duplicateLabel.setObjectName(u"duplicateLabel")
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred)
sizePolicy2.setHorizontalStretch(0)
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.duplicateLabel.sizePolicy().hasHeightForWidth())
self.duplicateLabel.setSizePolicy(sizePolicy2)
self.duplicateLabel.setMinimumSize(QSize(550, 0))
self.duplicateLabel.setStyleSheet(u"")
self.duplicateLabel.setWordWrap(True)

self.horizontalLayout_3.addWidget(self.duplicateLabel)

self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)

self.horizontalLayout_3.addItem(self.horizontalSpacer_2)


self.verticalLayout.addLayout(self.horizontalLayout_3)

self.columnsLayout = QHBoxLayout()
self.columnsLayout.setObjectName(u"columnsLayout")
self.leftColumnLayout = QVBoxLayout()
self.leftColumnLayout.setObjectName(u"leftColumnLayout")
self.numSelectedLabel = QLabel(MultiModelSelection)
self.numSelectedLabel.setObjectName(u"numSelectedLabel")
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
sizePolicy2.setHorizontalStretch(0)
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.numSelectedLabel.sizePolicy().hasHeightForWidth())
self.numSelectedLabel.setSizePolicy(sizePolicy2)
self.numSelectedLabel.setMinimumSize(QSize(0, 10))
self.numSelectedLabel.setStyleSheet(u"")
self.numSelectedLabel.setWordWrap(True)

self.verticalLayout.addWidget(self.numSelectedLabel)
self.leftColumnLayout.addWidget(self.numSelectedLabel)

self.columnsLayout = QHBoxLayout()
self.columnsLayout.setObjectName(u"columnsLayout")
self.leftColumnLayout = QVBoxLayout()
self.leftColumnLayout.setObjectName(u"leftColumnLayout")
self.modelListView = QListView(MultiModelSelection)
self.modelListView.setObjectName(u"modelListView")
sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy3.setHorizontalStretch(0)
sizePolicy3.setVerticalStretch(0)
sizePolicy3.setHeightForWidth(self.modelListView.sizePolicy().hasHeightForWidth())
self.modelListView.setSizePolicy(sizePolicy3)
self.modelListView.setStyleSheet(u"")
self.modelListView.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.modelListView.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection)
Expand All @@ -180,13 +178,24 @@ def setupUi(self, MultiModelSelection):

self.rightColumnLayout = QVBoxLayout()
self.rightColumnLayout.setObjectName(u"rightColumnLayout")
self.duplicateLabel = QLabel(MultiModelSelection)
self.duplicateLabel.setObjectName(u"duplicateLabel")
self.duplicateLabel.setEnabled(True)
sizePolicy2.setHeightForWidth(self.duplicateLabel.sizePolicy().hasHeightForWidth())
self.duplicateLabel.setSizePolicy(sizePolicy2)
self.duplicateLabel.setMinimumSize(QSize(0, 10))
self.duplicateLabel.setStyleSheet(u"")
self.duplicateLabel.setWordWrap(True)

self.rightColumnLayout.addWidget(self.duplicateLabel)

self.duplicateListWidget = QListWidget(MultiModelSelection)
self.duplicateListWidget.setObjectName(u"duplicateListWidget")
sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
sizePolicy3.setHorizontalStretch(0)
sizePolicy3.setVerticalStretch(0)
sizePolicy3.setHeightForWidth(self.duplicateListWidget.sizePolicy().hasHeightForWidth())
self.duplicateListWidget.setSizePolicy(sizePolicy3)
sizePolicy4 = QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Expanding)
sizePolicy4.setHorizontalStretch(0)
sizePolicy4.setVerticalStretch(0)
sizePolicy4.setHeightForWidth(self.duplicateListWidget.sizePolicy().hasHeightForWidth())
self.duplicateListWidget.setSizePolicy(sizePolicy4)
self.duplicateListWidget.setStyleSheet(u"")
self.duplicateListWidget.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.duplicateListWidget.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection)
Expand Down Expand Up @@ -219,7 +228,7 @@ def retranslateUi(self, MultiModelSelection):
self.radioAll.setText(QCoreApplication.translate("MultiModelSelection", u"All", None))
self.radioONNX.setText(QCoreApplication.translate("MultiModelSelection", u"ONNX", None))
self.radioReports.setText(QCoreApplication.translate("MultiModelSelection", u"Reports", None))
self.duplicateLabel.setText(QCoreApplication.translate("MultiModelSelection", u"The following models were found to be duplicates and have been deselected from the list on the left.", None))
self.numSelectedLabel.setText(QCoreApplication.translate("MultiModelSelection", u"0 selected models", None))
self.duplicateLabel.setText(QCoreApplication.translate("MultiModelSelection", u"Ignoring 0 duplicate model(s).", None))
# retranslateUi

2 changes: 1 addition & 1 deletion test/resnet18_reports/resnet18_report.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Report created on December 06, 2024
ONNX file: C:\Users\pcolange\Projects\digestai\test\resnet18.onnx
ONNX file: test\resnet18.onnx
Name of the model: resnet18
Model version: 0
Name of the graph: main_graph
Expand Down
2 changes: 1 addition & 1 deletion test/resnet18_reports/resnet18_report.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
report_date: December 06, 2024
model_file: C:\Users\pcolange\Projects\digestai\test\resnet18.onnx
model_file: test\resnet18.onnx
model_type: onnx
model_name: resnet18
model_version: 0
Expand Down

0 comments on commit a29f3a0

Please sign in to comment.