Skip to content

Commit

Permalink
INC Bench update (intel#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmyrcha authored Aug 7, 2022
1 parent 033e641 commit 8b664b6
Show file tree
Hide file tree
Showing 18 changed files with 122 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specifU77777777777
// ic language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, Inject, OnInit } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
Expand Down Expand Up @@ -42,9 +41,9 @@ export class BenchmarkFormComponent implements OnInit {

ngOnInit(): void {
this.name = 'Benchmark' + String(this.data.index + 1);
if (this.data.framework === "pytorch"){
this.modes = ['performance']
}
if (this.data.framework === "pytorch") {
this.modes = ['performance'];
}
this.getDatasetList()
this.modelService.getModelList(this.data.projectId)
.subscribe(
Expand All @@ -64,7 +63,7 @@ export class BenchmarkFormComponent implements OnInit {
iterations: [10],
numOfInstance: [this.modelService.systemInfo['cores_per_socket'] * this.modelService.systemInfo['sockets'] / 4],
coresPerInstance: [4],
commandLine:['']
commandLine: ['']
});

this.modelService.datasetCreated$.subscribe(response => this.getDatasetList());
Expand Down Expand Up @@ -104,7 +103,7 @@ export class BenchmarkFormComponent implements OnInit {
number_of_instance: this.benchmarkFormGroup.get('numOfInstance').value,
cores_per_instance: this.benchmarkFormGroup.get('coresPerInstance').value,
warmup_iterations: this.benchmarkFormGroup.get('warmup').value,
command_line:this.benchmarkFormGroup.get('commandLine').value
command_line: this.benchmarkFormGroup.get('commandLine').value
})
.subscribe(
response => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,41 +176,21 @@ <h2>Dataset</h2>
<div class="item">
<h2>Model</h2>
<table class="rounded">
<ng-container *ngIf="framework.toLowerCase() !== 'pytorch'">
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports')">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
</tr>
</ng-container>
</ng-container>
<ng-container *ngIf="framework.toLowerCase() === 'pytorch'">
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports') && !detail.key.includes('nodes')&& !detail.key.includes('domain')">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
</tr>
</ng-container>
<ng-container *ngFor="let detail of benchmarkDetails['model'] | keyvalue">
<tr *ngIf="detail.value && isParameterVisible(detail.key)">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
</tr>
</ng-container>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class BenchmarksComponent implements OnInit {
benchmarkDetails: any;
comparison = {};
showComparison = false;
hiddenFields = {
tensorflow: ['id', 'supports'],
pytorch: ['id', 'supports', 'nodes', 'domain']
};

accuracyData;
throughputData;
Expand Down Expand Up @@ -139,7 +143,6 @@ export class BenchmarksComponent implements OnInit {
projectId: this.activatedRoute.snapshot.params.id,
index: this.benchmarks.length,
framework: this.framework.toLowerCase()

}
});

Expand Down Expand Up @@ -259,6 +262,18 @@ export class BenchmarksComponent implements OnInit {
});
}

isParameterVisible(parameter: string): boolean {
let isVisible = true;
this.hiddenFields[this.framework.toLowerCase()]
.forEach(field => {
if (parameter.includes(field)) {
isVisible = false;
return;
}
});
return isVisible;
}

typeOf(object) {
return typeof object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,17 @@ export class DatasetFormComponent implements OnInit {


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

let tranformParameters: { name: string, value: any }[] = this.transformations.find(x => x.name === event.value.name).params
let transformParameters: { name: string, value: any }[] = this.transformations.find(x => x.name === event.value.name).params;
event.value.params.forEach(item => {
tranformParameters.find(x => x.name === item.name).value = item.value;
})
this.transformationParams[index]['params'] = tranformParameters;
transformParameters.find(x => x.name === item.name).value = item.value;
});
this.transformationParams[index]['params'] = transformParameters;
}

addNewTransformation(name?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2 matTooltip="Check framework user guide for precision support.">Precision</h2
</div>
</mat-step>

<mat-step [completed]="false" *ngIf="data.framework === 'pytorch'">
<mat-step [completed]="false" *ngIf="data.framework === 'pytorch'">
<ng-template matStepLabel>Precision</ng-template>
<h2 matTooltip="Check framework user guide for precision support.">Precision</h2>
<p>Choose precision of the optimization. Precision determines available optimization types.</p>
Expand All @@ -53,7 +53,7 @@ <h2 matTooltip="Check framework user guide for precision support.">Precision</h2
<img class="navigation-icon" src="./../../assets/056a-save-solid-white.svg">
Finish
</button>
</div>
</div>
</mat-step>
<mat-step [completed]="false" *ngIf="data.framework !== 'pytorch'">
<ng-template matStepLabel>Dataset</ng-template>
Expand All @@ -79,4 +79,4 @@ <h2>Dataset</h2>
</button>
</div>
</mat-step>
</mat-horizontal-stepper>
</mat-horizontal-stepper>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { ElementSchemaRegistry } from '@angular/compiler';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ModelService } from '../services/model.service';
Expand All @@ -27,12 +26,11 @@ export class OptimizationFormComponent implements OnInit {
precisionsPyTorch = []
precisionsOther = []
precisionId: number;
showprecisionList=["tensorflow","pytorch"]
optimizationTypes = [];
optimizationTypeId: number;

datasets = [];
datasetId:number = 0;
datasetId: number = 0;
name: string;

constructor(
Expand All @@ -41,7 +39,7 @@ export class OptimizationFormComponent implements OnInit {
) { }

ngOnInit(): void {
this.name = "Optimization" + String(this.data.index + 1);
this.name = 'Optimization' + String(this.data.index + 1);
this.getPrecisions();
this.getDatasets();
this.modelService.datasetCreated$.subscribe(response => this.getDatasets());
Expand All @@ -54,17 +52,18 @@ export class OptimizationFormComponent implements OnInit {
this.precisions = response['precisions'];
this.precisionId = this.precisions.find(x => x.name === 'int8').id;
this.precisions.forEach((element) => {
if (element.name === "int8 dynamic quantization" || element.name ==='int8 static quantization') {
let insert=Object.assign({},element);
if (element.name === 'int8 dynamic quantization' || element.name === 'int8 static quantization') {
let insert = Object.assign({}, element);
this.precisionsPyTorch.push(insert);
}else{
let tmp=Object.assign({},element);
this.precisionsOther.push(tmp);}
} else {
let tmp = Object.assign({}, element);
this.precisionsOther.push(tmp);
}
});
if(this.data.framework === "pytorch"){
this.precisions=this.precisionsPyTorch;
}else{
this.precisions=this.precisionsOther;
if (this.data.framework === 'pytorch') {
this.precisions = this.precisionsPyTorch;
} else {
this.precisions = this.precisionsOther;
}
this.getOptimizationTypes();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,51 +162,26 @@ <h2>Tuning details</h2>
<div class="item" *ngIf="optimizationDetails['optimized_model']">
<h2>Model</h2>
<table class="rounded">
<ng-container *ngIf="framework.toLowerCase() !== 'pytorch'">
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports') ">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
<td>
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
src="./../../assets/160a-download-solid.svg">
</td>
</tr>
</ng-container>
</ng-container>
<ng-container *ngIf="framework.toLowerCase() === 'pytorch'">
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
<tr *ngIf="detail.value && !detail.key.includes('id') && !detail.key.includes('supports')&& !detail.key.includes('domain')&& !detail.key.includes('nodes') ">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
<td>
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
src="./../../assets/160a-download-solid.svg">
</td>
</tr>
</ng-container>
<ng-container *ngFor="let detail of optimizationDetails['optimized_model'] | keyvalue">
<tr *ngIf="detail.value && isParameterVisible(detail.key)">
<th>{{ detail.key | modelList }}</th>
<td class="wrap" *ngIf="typeOf(detail.value) === 'string' || typeOf(detail.value) === 'number'">
{{ detail.value }} {{ detail.key === 'size' ? 'MB' : null }}
</td>
<td *ngIf="typeOf(detail.value) === 'object' && detail.value">
{{ detail.value.name ?? (detail.value | json) }}
</td>
<td>
<img *ngIf="detail.key.includes('path')" class="icon-button right"
src="./../../assets/146a-copy-solid.svg" matTooltip="Copy path to clipboard" matTooltipPosition="after"
(click)="copyToClipboard(detail.value)">
</td>
<td>
<img *ngIf="detail.key === 'path'" class="help-button right pointer" matTooltip="Download model"
(click)="downloadModel(optimizationDetails['optimized_model']['path'], optimizationDetails['optimized_model']['id'])"
src="./../../assets/160a-download-solid.svg">
</td>
</tr>
</ng-container>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class OptimizationsComponent implements OnInit {
showPerformanceDropdown = {};
labels = ['Input', 'Optimized'];

hiddenFields = {
tensorflow: ['id', 'supports'],
pytorch: ['id', 'supports', 'nodes', 'domain']
};

xAxis: boolean = true;
yAxis: boolean = true;
showYAxisLabel: boolean = true;
Expand Down Expand Up @@ -350,6 +355,18 @@ export class OptimizationsComponent implements OnInit {
return path.replace(/^.*[\\\/]/, '');
}

isParameterVisible(parameter: string): boolean {
let isVisible = true;
this.hiddenFields[this.framework.toLowerCase()]
.forEach(field => {
if (parameter.includes(field)) {
isVisible = false;
return;
}
});
return isVisible;
}

typeOf(object) {
return typeof object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h2>Custom model</h2>
</div>
</mat-card>

<ng-container *ngIf="projectFormGroup.get('framework').value && projectFormGroup.get('framework').value !== 'PyTorch'">
<ng-container *ngIf="projectFormGroup.get('framework')?.value !== 'PyTorch'">
<ng-container *ngIf="showDomain">
<h2>Model domain</h2>
<mat-card>
Expand Down Expand Up @@ -165,7 +165,7 @@ <h2>Dummy dataset</h2>
</mat-form-field>
</mat-card>
</ng-container>
<ng-container *ngIf="projectFormGroup.get('framework').value && projectFormGroup.get('framework').value === 'PyTorch'">
<ng-container *ngIf="projectFormGroup.get('framework')?.value === 'PyTorch'">
<mat-card>
<p>Neural Coder will be used for PyTorch script-based model optimization and benchmark.</p>
</mat-card>
Expand Down
14 changes: 6 additions & 8 deletions neural_compressor/ux/gui/src/app/project/project.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,23 @@ <h1 joyrideStep="intro" [stepContent]="intro">{{ project['name'] ?? 'Project nam
</mat-tab>
</ng-container>

<mat-tab [disabled]="is_pytorch">
<mat-tab [disabled]="is_pytorch">
<ng-template mat-tab-label>
<img *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'" class="tab-icon"
src="./../../assets/234a-database-solid.svg">
<img *ngIf="project['input_model']['framework']['name'] === 'PyTorch'" class="tab-icon"
src="./../../assets/234a-database-solid-disable.svg">
<img *ngIf="!is_pytorch" class="tab-icon" src="./../../assets/234a-database-solid.svg">
<img *ngIf="is_pytorch" class="tab-icon" src="./../../assets/234a-database-solid-disable.svg">
<div joyrideStep="datasetTour" [stepContent]="datasetTour"
[matTooltip]="!is_pytorch ? null :'Datasets is not available for PyTorch Script-based Model.'">
Datasets
</div>
</ng-template>
<ng-template #datasetsTour *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'">
<ng-template #datasetsTour *ngIf="!is_pytorch">
Add new datasets to experiment with the model.
</ng-template>
<app-datasets *ngIf="project['input_model']['framework']['name'] !== 'PyTorch'" [framework]="project['input_model']['framework']['name']"
<app-datasets *ngIf="!is_pytorch" [framework]="project['input_model']['framework']['name']"
[domain]="project['input_model']['domain']['name']"
[domainFlavour]="project['input_model']['domain_flavour']['name']">
</app-datasets>
<p *ngIf="project['input_model']['framework']['name'] === 'PyTorch'">Datasets is not available for PyTorch Script-based Model.</p>
<p *ngIf="is_pytorch">Datasets is not available for PyTorch Script-based Model.</p>
</mat-tab>

<ng-container *ngIf="project['input_model']">
Expand Down
Loading

0 comments on commit 8b664b6

Please sign in to comment.