@@ -45,6 +45,7 @@ import { UploadModelSocketDTO } from '@shared/models/dto/upload-socket-message-d
45
45
import { DeviceItem } from '@shared/models/device' ;
46
46
import { AccuracyReportType } from '@shared/models/accuracy-analysis/accuracy-report' ;
47
47
import { ITokenizer , TOKENIZER_TYPE_NAME } from '@shared/models/tokenizer/tokenizer' ;
48
+ import { IHuggingfaceModel } from '@shared/models/huggingface/huggingface-model' ;
48
49
49
50
import { PrecisionAnalysisService } from '../../../modules/dashboard/components/precision-analysis/precision-analysis.service' ;
50
51
import { ExecutedLayerItem } from '../../../modules/dashboard/components/model-layers-with-graphs/layers-table/layers-table.model' ;
@@ -86,6 +87,10 @@ export const enum GAActions {
86
87
DEVICES = 'Devices' ,
87
88
CANCEL = 'Cancel' ,
88
89
OMZ_DOWNLOAD = 'OMZ Download' ,
90
+ HUGGINGFACE_IMPORT_START = 'Huggingface import start' ,
91
+ HUGGINGFACE_IMPORT = 'Huggingface import' ,
92
+ HUGGINGFACE_LIST = 'Huggingface list' ,
93
+ HUGGINGFACE_MODEL_DETAILS = 'Huggingface model details' ,
89
94
LOCAL_UPLOAD = 'Local Upload' ,
90
95
COMPARE = 'Compare' ,
91
96
CREATE = 'Create' ,
@@ -171,6 +176,7 @@ export class GoogleAnalyticsService {
171
176
originalDatasetType : DatasetTypeToNameMap [ dataset . originalType ] ,
172
177
modelName : isOMZ ? model . name : 'other' ,
173
178
isOMZ,
179
+ modelSource : model . modelSource ,
174
180
target : TargetMachineTypesNamesMap [ machine . targetType ] ,
175
181
autogenerated,
176
182
OS : machine . operatingSystem ,
@@ -301,19 +307,28 @@ export class GoogleAnalyticsService {
301
307
302
308
public emitUploadModelEvent ( modelDescription : UploadModelSocketDTO , model : ModelItem ) : void {
303
309
const modelDomain = modelDomainNames [ model . domain ] ;
304
- if ( model . modelSource !== ModelSources . OMZ ) {
305
- this . emitEvent ( GAActions . LOCAL_UPLOAD , Categories . MODEL , { modelDomain } ) ;
310
+ if ( model . modelSource === ModelSources . OMZ ) {
311
+ this . emitEvent ( GAActions . OMZ_DOWNLOAD , Categories . MODEL , {
312
+ name : modelDescription . name ,
313
+ precisions : modelDescription . bodyPrecisions . join ( ' ' ) ,
314
+ framework : modelFrameworkNamesMap [ model . framework ] ,
315
+ modelType : TaskMethodToNameMap [ model . accuracyConfiguration . taskMethod ] ,
316
+ modelDomain,
317
+ downloadTime : GoogleAnalyticsService . getJobExecTime ( modelDescription . date ) ,
318
+ } ) ;
306
319
return ;
307
320
}
308
321
309
- this . emitEvent ( GAActions . OMZ_DOWNLOAD , Categories . MODEL , {
310
- name : modelDescription . name ,
311
- precisions : modelDescription . bodyPrecisions . join ( ' ' ) ,
312
- framework : modelFrameworkNamesMap [ model . framework ] ,
313
- modelType : TaskMethodToNameMap [ model . accuracyConfiguration . taskMethod ] ,
314
- modelDomain,
315
- downloadTime : GoogleAnalyticsService . getJobExecTime ( modelDescription . date ) ,
316
- } ) ;
322
+ if ( model . modelSource === ModelSources . HUGGINGFACE ) {
323
+ this . emitEvent ( GAActions . HUGGINGFACE_IMPORT , Categories . MODEL , {
324
+ name : modelDescription . name ,
325
+ modelDomain,
326
+ modelSource : model . modelSource ,
327
+ } ) ;
328
+ return ;
329
+ }
330
+
331
+ this . emitEvent ( GAActions . LOCAL_UPLOAD , Categories . MODEL , { modelDomain } ) ;
317
332
}
318
333
319
334
public emitOptimizationEvent (
@@ -497,4 +512,32 @@ export class GoogleAnalyticsService {
497
512
[ DimensionsEnum . VERSION ] : version ,
498
513
} ) ;
499
514
}
515
+
516
+ public emitImportHuggingfaceModelStart ( model : IHuggingfaceModel ) : void {
517
+ this . emitEvent ( GAActions . HUGGINGFACE_IMPORT_START , Categories . MODEL , {
518
+ huggingfaceModelId : model . id ,
519
+ modelType : model . config ?. modelType ,
520
+ pipelineTag : model . pipelineTag ,
521
+ } ) ;
522
+ }
523
+
524
+ public emitImportHuggingfaceModelFailure ( error : string ) : void {
525
+ this . emitEvent ( GAActions . HUGGINGFACE_IMPORT , Categories . ERROR , { error } ) ;
526
+ }
527
+
528
+ public emitHuggingfaceListLoad ( timeToLoad : number ) : void {
529
+ this . emitEvent ( GAActions . HUGGINGFACE_LIST , Categories . MODEL , { timeToLoad } ) ;
530
+ }
531
+
532
+ public emitHuggingfaceListLoadFailure ( error : string ) : void {
533
+ this . emitEvent ( GAActions . HUGGINGFACE_LIST , Categories . ERROR , { error } ) ;
534
+ }
535
+
536
+ public emitHuggingfaceLoadReadmeSuccess ( huggingfaceModelId : string ) : void {
537
+ this . emitEvent ( GAActions . HUGGINGFACE_MODEL_DETAILS , Categories . MODEL , { huggingfaceModelId } ) ;
538
+ }
539
+
540
+ public emitHuggingfaceLoadReadmeFailure ( huggingfaceModelId : string , error : string ) : void {
541
+ this . emitEvent ( GAActions . HUGGINGFACE_MODEL_DETAILS , Categories . ERROR , { huggingfaceModelId, error } ) ;
542
+ }
500
543
}
0 commit comments