Skip to content

Commit 8b664b6

Browse files
authored
INC Bench update (#1132)
1 parent 033e641 commit 8b664b6

18 files changed

+122
-132
lines changed

neural_compressor/ux/gui/src/app/benchmark-form/benchmark-form.component.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specifU77777777777
13-
// ic language governing permissions and
12+
// See the License for the specific language governing permissions and
1413
// limitations under the License.
1514
import { Component, Inject, OnInit } from '@angular/core';
1615
import { FormGroup, FormBuilder } from '@angular/forms';
@@ -42,9 +41,9 @@ export class BenchmarkFormComponent implements OnInit {
4241

4342
ngOnInit(): void {
4443
this.name = 'Benchmark' + String(this.data.index + 1);
45-
if (this.data.framework === "pytorch"){
46-
this.modes = ['performance']
47-
}
44+
if (this.data.framework === "pytorch") {
45+
this.modes = ['performance'];
46+
}
4847
this.getDatasetList()
4948
this.modelService.getModelList(this.data.projectId)
5049
.subscribe(
@@ -64,7 +63,7 @@ export class BenchmarkFormComponent implements OnInit {
6463
iterations: [10],
6564
numOfInstance: [this.modelService.systemInfo['cores_per_socket'] * this.modelService.systemInfo['sockets'] / 4],
6665
coresPerInstance: [4],
67-
commandLine:['']
66+
commandLine: ['']
6867
});
6968

7069
this.modelService.datasetCreated$.subscribe(response => this.getDatasetList());
@@ -104,7 +103,7 @@ export class BenchmarkFormComponent implements OnInit {
104103
number_of_instance: this.benchmarkFormGroup.get('numOfInstance').value,
105104
cores_per_instance: this.benchmarkFormGroup.get('coresPerInstance').value,
106105
warmup_iterations: this.benchmarkFormGroup.get('warmup').value,
107-
command_line:this.benchmarkFormGroup.get('commandLine').value
106+
command_line: this.benchmarkFormGroup.get('commandLine').value
108107
})
109108
.subscribe(
110109
response => {

neural_compressor/ux/gui/src/app/benchmarks/benchmarks.component.html

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -176,41 +176,21 @@ <h2>Dataset</h2>
176176
<div class="item">
177177
<h2>Model</h2>
178178
<table class="rounded">
179-
<ng-container *ngIf="framework.toLowerCase() !== 'pytorch'">
180-
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
181-
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports')">
182-
<th>{{ detail.key | modelList }}</th>
183-
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
184-
{{ detail.value }}
185-
</td>
186-
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
187-
{{ detail.value.name ?? (detail.value | json) }}
188-
</td>
189-
<td>
190-
<img *ngIf="detail.key.includes('path')" class="icon-button right"
191-
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
192-
(click)="copyToClipboard(detail.value)">
193-
</td>
194-
</tr>
195-
</ng-container>
196-
</ng-container>
197-
<ng-container *ngIf="framework.toLowerCase() === 'pytorch'">
198-
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
199-
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports') && !detail.key.includes('nodes')&& !detail.key.includes('domain')">
200-
<th>{{ detail.key | modelList }}</th>
201-
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
202-
{{ detail.value }}
203-
</td>
204-
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
205-
{{ detail.value.name ?? (detail.value | json) }}
206-
</td>
207-
<td>
208-
<img *ngIf="detail.key.includes('path')" class="icon-button right"
209-
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
210-
(click)="copyToClipboard(detail.value)">
211-
</td>
212-
</tr>
213-
</ng-container>
179+
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
180+
<tr *ngIf="detail.value && isParameterVisible(detail.key)">
181+
<th>{{ detail.key | modelList }}</th>
182+
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
183+
{{ detail.value }}
184+
</td>
185+
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
186+
{{ detail.value.name ?? (detail.value | json) }}
187+
</td>
188+
<td>
189+
<img *ngIf="detail.key.includes('path')" class="icon-button right"
190+
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
191+
(click)="copyToClipboard(detail.value)">
192+
</td>
193+
</tr>
214194
</ng-container>
215195
</table>
216196
</div>

neural_compressor/ux/gui/src/app/benchmarks/benchmarks.component.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export class BenchmarksComponent implements OnInit {
4747
benchmarkDetails: any;
4848
comparison = {};
4949
showComparison = false;
50+
hiddenFields = {
51+
tensorflow: ['id', 'supports'],
52+
pytorch: ['id', 'supports', 'nodes', 'domain']
53+
};
5054

5155
accuracyData;
5256
throughputData;
@@ -139,7 +143,6 @@ export class BenchmarksComponent implements OnInit {
139143
projectId: this.activatedRoute.snapshot.params.id,
140144
index: this.benchmarks.length,
141145
framework: this.framework.toLowerCase()
142-
143146
}
144147
});
145148

@@ -259,6 +262,18 @@ export class BenchmarksComponent implements OnInit {
259262
});
260263
}
261264

265+
isParameterVisible(parameter: string): boolean {
266+
let isVisible = true;
267+
this.hiddenFields[this.framework.toLowerCase()]
268+
.forEach(field => {
269+
if (parameter.includes(field)) {
270+
isVisible = false;
271+
return;
272+
}
273+
});
274+
return isVisible;
275+
}
276+
262277
typeOf(object) {
263278
return typeof object;
264279
}

neural_compressor/ux/gui/src/app/dataset-form/dataset-form.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,17 @@ export class DatasetFormComponent implements OnInit {
174174

175175

176176
setDefaultTransformationParam(event, index: number) {
177-
if (!event.value.hasOwnProperty("params")) {
177+
if (!event.value.hasOwnProperty('params')) {
178178
// Case when event source is MatSelect
179179
this.transformationParams[index]['params'] = this.transformations.find(x => x.name === event.value).params;
180-
return
180+
return;
181181
}
182182

183-
let tranformParameters: { name: string, value: any }[] = this.transformations.find(x => x.name === event.value.name).params
183+
let transformParameters: { name: string, value: any }[] = this.transformations.find(x => x.name === event.value.name).params;
184184
event.value.params.forEach(item => {
185-
tranformParameters.find(x => x.name === item.name).value = item.value;
186-
})
187-
this.transformationParams[index]['params'] = tranformParameters;
185+
transformParameters.find(x => x.name === item.name).value = item.value;
186+
});
187+
this.transformationParams[index]['params'] = transformParameters;
188188
}
189189

190190
addNewTransformation(name?: string) {

neural_compressor/ux/gui/src/app/optimization-form/optimization-form.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2 matTooltip="Check framework user guide for precision support.">Precision</h2
3535
</div>
3636
</mat-step>
3737

38-
<mat-step [completed]="false" *ngIf="data.framework === 'pytorch'">
38+
<mat-step [completed]="false" *ngIf="data.framework === 'pytorch'">
3939
<ng-template matStepLabel>Precision</ng-template>
4040
<h2 matTooltip="Check framework user guide for precision support.">Precision</h2>
4141
<p>Choose precision of the optimization. Precision determines available optimization types.</p>
@@ -53,7 +53,7 @@ <h2 matTooltip="Check framework user guide for precision support.">Precision</h2
5353
<img class="navigation-icon" src="./../../assets/056a-save-solid-white.svg">
5454
Finish
5555
</button>
56-
</div>
56+
</div>
5757
</mat-step>
5858
<mat-step [completed]="false" *ngIf="data.framework !== 'pytorch'">
5959
<ng-template matStepLabel>Dataset</ng-template>
@@ -79,4 +79,4 @@ <h2>Dataset</h2>
7979
</button>
8080
</div>
8181
</mat-step>
82-
</mat-horizontal-stepper>
82+
</mat-horizontal-stepper>

neural_compressor/ux/gui/src/app/optimization-form/optimization-form.component.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
import { ElementSchemaRegistry } from '@angular/compiler';
1514
import { Component, Inject, OnInit } from '@angular/core';
1615
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
1716
import { ModelService } from '../services/model.service';
@@ -27,12 +26,11 @@ export class OptimizationFormComponent implements OnInit {
2726
precisionsPyTorch = []
2827
precisionsOther = []
2928
precisionId: number;
30-
showprecisionList=["tensorflow","pytorch"]
3129
optimizationTypes = [];
3230
optimizationTypeId: number;
3331

3432
datasets = [];
35-
datasetId:number = 0;
33+
datasetId: number = 0;
3634
name: string;
3735

3836
constructor(
@@ -41,7 +39,7 @@ export class OptimizationFormComponent implements OnInit {
4139
) { }
4240

4341
ngOnInit(): void {
44-
this.name = "Optimization" + String(this.data.index + 1);
42+
this.name = 'Optimization' + String(this.data.index + 1);
4543
this.getPrecisions();
4644
this.getDatasets();
4745
this.modelService.datasetCreated$.subscribe(response => this.getDatasets());
@@ -54,17 +52,18 @@ export class OptimizationFormComponent implements OnInit {
5452
this.precisions = response['precisions'];
5553
this.precisionId = this.precisions.find(x => x.name === 'int8').id;
5654
this.precisions.forEach((element) => {
57-
if (element.name === "int8 dynamic quantization" || element.name ==='int8 static quantization') {
58-
let insert=Object.assign({},element);
55+
if (element.name === 'int8 dynamic quantization' || element.name === 'int8 static quantization') {
56+
let insert = Object.assign({}, element);
5957
this.precisionsPyTorch.push(insert);
60-
}else{
61-
let tmp=Object.assign({},element);
62-
this.precisionsOther.push(tmp);}
58+
} else {
59+
let tmp = Object.assign({}, element);
60+
this.precisionsOther.push(tmp);
61+
}
6362
});
64-
if(this.data.framework === "pytorch"){
65-
this.precisions=this.precisionsPyTorch;
66-
}else{
67-
this.precisions=this.precisionsOther;
63+
if (this.data.framework === 'pytorch') {
64+
this.precisions = this.precisionsPyTorch;
65+
} else {
66+
this.precisions = this.precisionsOther;
6867
}
6968
this.getOptimizationTypes();
7069
},

neural_compressor/ux/gui/src/app/optimizations/optimizations.component.html

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -162,51 +162,26 @@ <h2>Tuning details</h2>
162162
<div class="item" *ngIf="optimizationDetails['optimized_model']">
163163
<h2>Model</h2>
164164
<table class="rounded">
165-
<ng-container *ngIf="framework.toLowerCase() !== 'pytorch'">
166-
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
167-
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports') ">
168-
<th>{{ detail.key | modelList }}</th>
169-
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
170-
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
171-
</td>
172-
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
173-
{{ detail.value.name ?? (detail.value | json) }}
174-
</td>
175-
<td>
176-
<img *ngIf="detail.key.includes('path')" class="icon-button right"
177-
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
178-
(click)="copyToClipboard(detail.value)">
179-
</td>
180-
<td>
181-
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
182-
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
183-
src="./../../assets/160a-download-solid.svg">
184-
</td>
185-
</tr>
186-
</ng-container>
187-
</ng-container>
188-
<ng-container *ngIf="framework.toLowerCase() === 'pytorch'">
189-
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
190-
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports')&& !detail.key.includes('domain')&& !detail.key.includes('nodes') ">
191-
<th>{{ detail.key | modelList }}</th>
192-
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
193-
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
194-
</td>
195-
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
196-
{{ detail.value.name ?? (detail.value | json) }}
197-
</td>
198-
<td>
199-
<img *ngIf="detail.key.includes('path')" class="icon-button right"
200-
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
201-
(click)="copyToClipboard(detail.value)">
202-
</td>
203-
<td>
204-
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
205-
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
206-
src="./../../assets/160a-download-solid.svg">
207-
</td>
208-
</tr>
209-
</ng-container>
165+
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
166+
<tr *ngIf="detail.value && isParameterVisible(detail.key)">
167+
<th>{{ detail.key | modelList }}</th>
168+
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
169+
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
170+
</td>
171+
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
172+
{{ detail.value.name ?? (detail.value | json) }}
173+
</td>
174+
<td>
175+
<img *ngIf="detail.key.includes('path')" class="icon-button right"
176+
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
177+
(click)="copyToClipboard(detail.value)">
178+
</td>
179+
<td>
180+
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
181+
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
182+
src="./../../assets/160a-download-solid.svg">
183+
</td>
184+
</tr>
210185
</ng-container>
211186
</table>
212187
</div>

neural_compressor/ux/gui/src/app/optimizations/optimizations.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ export class OptimizationsComponent implements OnInit {
5656
showPerformanceDropdown = {};
5757
labels = ['Input', 'Optimized'];
5858

59+
hiddenFields = {
60+
tensorflow: ['id', 'supports'],
61+
pytorch: ['id', 'supports', 'nodes', 'domain']
62+
};
63+
5964
xAxis: boolean = true;
6065
yAxis: boolean = true;
6166
showYAxisLabel: boolean = true;
@@ -350,6 +355,18 @@ export class OptimizationsComponent implements OnInit {
350355
return path.replace(/^.*[\\\/]/, '');
351356
}
352357

358+
isParameterVisible(parameter: string): boolean {
359+
let isVisible = true;
360+
this.hiddenFields[this.framework.toLowerCase()]
361+
.forEach(field => {
362+
if (parameter.includes(field)) {
363+
isVisible = false;
364+
return;
365+
}
366+
});
367+
return isVisible;
368+
}
369+
353370
typeOf(object) {
354371
return typeof object;
355372
}

neural_compressor/ux/gui/src/app/project-form/project-form.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h2>Custom model</h2>
132132
</div>
133133
</mat-card>
134134

135-
<ng-container *ngIf="projectFormGroup.get('framework').value && projectFormGroup.get('framework').value !== 'PyTorch'">
135+
<ng-container *ngIf="projectFormGroup.get('framework')?.value !== 'PyTorch'">
136136
<ng-container *ngIf="showDomain">
137137
<h2>Model domain</h2>
138138
<mat-card>
@@ -165,7 +165,7 @@ <h2>Dummy dataset</h2>
165165
</mat-form-field>
166166
</mat-card>
167167
</ng-container>
168-
<ng-container *ngIf="projectFormGroup.get('framework').value && projectFormGroup.get('framework').value === 'PyTorch'">
168+
<ng-container *ngIf="projectFormGroup.get('framework')?.value === 'PyTorch'">
169169
<mat-card>
170170
<p>Neural Coder will be used for PyTorch script-based model optimization and benchmark.</p>
171171
</mat-card>

neural_compressor/ux/gui/src/app/project/project.component.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,23 @@ <h1 joyrideStep="intro" [stepContent]="intro">{{ project['name'] ?? 'Project nam
6060
</mat-tab>
6161
</ng-container>
6262

63-
<mat-tab [disabled]="is_pytorch">
63+
<mat-tab [disabled]="is_pytorch">
6464
<ng-template mat-tab-label>
65-
<img *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'" class="tab-icon"
66-
src="./../../assets/234a-database-solid.svg">
67-
<img *ngIf="project['input_model']['framework']['name'] === 'PyTorch'" class="tab-icon"
68-
src="./../../assets/234a-database-solid-disable.svg">
65+
<img *ngIf="!is_pytorch" class="tab-icon" src="./../../assets/234a-database-solid.svg">
66+
<img *ngIf="is_pytorch" class="tab-icon" src="./../../assets/234a-database-solid-disable.svg">
6967
<div joyrideStep="datasetTour" [stepContent]="datasetTour"
7068
[matTooltip]="!is_pytorch ? null :'Datasets is not available for PyTorch Script-based Model.'">
7169
Datasets
7270
</div>
7371
</ng-template>
74-
<ng-template #datasetsTour *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'">
72+
<ng-template #datasetsTour *ngIf="!is_pytorch">
7573
Add new datasets to experiment with the model.
7674
</ng-template>
77-
<app-datasets *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'" [framework]="project['input_model']['framework']['name']"
75+
<app-datasets *ngIf="!is_pytorch" [framework]="project['input_model']['framework']['name']"
7876
[domain]="project['input_model']['domain']['name']"
7977
[domainFlavour]="project['input_model']['domain_flavour']['name']">
8078
</app-datasets>
81-
<p *ngIf="project['input_model']['framework']['name'] === 'PyTorch'">Datasets is not available for PyTorch Script-based Model.</p>
79+
<p *ngIf="is_pytorch">Datasets is not available for PyTorch Script-based Model.</p>
8280
</mat-tab>
8381

8482
<ng-container *ngIf="project['input_model']">

0 commit comments

Comments
 (0)