@@ -33,12 +33,14 @@ interface ColumnHparam {
3333 filterInterval ?: MinMax | null ;
3434 filterRegexp ?: string ;
3535 order ?: string ;
36+ includeInResult : boolean ;
3637}
3738
3839interface ColumnMetric {
3940 metric : string ;
4041 filterInterval ?: MinMax | null ;
4142 order ?: string ;
43+ includeInResult : boolean ;
4244}
4345
4446const MAX_DOMAIN_DISCRETE_LIST_LEN = 10 ;
@@ -56,6 +58,12 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
5658 < hparams-split-layout orientation ="vertical ">
5759 < div slot ="content " class ="section hyperparameters ">
5860 < div class ="section-title "> Hyperparameters</ div >
61+ < template is ="dom-if " if ="[[_TooManyHparams]] ">
62+ < div class ="too-many-hparams ">
63+ Warning: There were too many hparams to load all of them
64+ efficiently. Only [[_maxNumHparamsToLoad]] were loaded.
65+ </ div >
66+ </ template >
5967 < template is ="dom-repeat " items ="{{_hparams}} " as ="hparam ">
6068 < div class ="hparam ">
6169 < paper-checkbox
@@ -271,6 +279,12 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
271279 text-decoration : underline;
272280 margin-bottom : 7px ;
273281 }
282+ .too-many-hparams {
283+ color : var (--tb-orange-dark );
284+ font-size : 13px ;
285+ font-style : italic;
286+ margin : 12px 0 ;
287+ }
274288 .discrete-value-checkbox ,
275289 .metric-checkbox ,
276290 .hparam-checkbox {
@@ -432,6 +446,12 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
432446 // 'regexp' string field containing the filtering regexp.
433447 @property ( { type : Array } )
434448 _hparams : any [ ] ;
449+ // The limit to the number of hparams we will load. Loading too many will slow
450+ // down the UI noticeably and possibly crash it.
451+ @property ( { type : Number } ) _maxNumHparamsToLoad : number = 1000 ;
452+ // Tracks whether we loaded the maximum number of allowed hparams as defined
453+ // by _maxNumHparamsToLoad.
454+ @property ( { type : Boolean } ) _tooManyHparams : boolean = false ;
435455 // An array of objects--each storing information about the user
436456 // setting for a single metric. Each object has the following fields:
437457 // info: The MetricInfo object returned by the backend in the
@@ -545,6 +565,7 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
545565 }
546566 const experimentRequest = {
547567 experimentName : this . experimentName ,
568+ hparamsLimit : this . _maxNumHparamsToLoad ,
548569 } ;
549570 this . backend
550571 . getExperiment ( experimentRequest )
@@ -636,6 +657,7 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
636657 result [ i ] . displayed = true ;
637658 }
638659 this . set ( '_hparams' , result ) ;
660+ this . set ( '_TooManyHparams' , result . length >= this . _maxNumHparamsToLoad ) ;
639661 }
640662 // Updates the _metrics property from the _experiment property.
641663 _computeMetrics ( ) {
@@ -851,7 +873,10 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
851873 let colParams : ( ColumnHparam | ColumnMetric ) [ ] = [ ] ;
852874 // Build the hparams filters in the request.
853875 this . _hparams . forEach ( ( hparam , index ) => {
854- let colParam : ColumnHparam = { hparam : hparam . info . name } ;
876+ let colParam : ColumnHparam = {
877+ hparam : hparam . info . name ,
878+ includeInResult : true ,
879+ } ;
855880 if ( hparam . filter . domainDiscrete ) {
856881 const allChecked = hparam . filter . domainDiscrete . every (
857882 ( filterVal ) => filterVal . checked
@@ -880,6 +905,7 @@ class TfHparamsQueryPane extends LegacyElementMixin(PolymerElement) {
880905 this . _metrics . forEach ( ( metric , index ) => {
881906 let colParam : ColumnMetric = {
882907 metric : metric . info . name ,
908+ includeInResult : true ,
883909 } ;
884910 if ( isIntervalSet ( metric . filter . interval ) ) {
885911 colParam . filterInterval = parseInputInterval (
0 commit comments