This repository was archived by the owner on Jan 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
mesh_tensorflow/transformer Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -2268,10 +2268,15 @@ def eval_model(estimator,
2268
2268
summary = tf .Summary ()
2269
2269
targets = cached_targets [eval_dataset .name ]
2270
2270
metric_result = metric_fn (targets , predictions )
2271
- for metric_name , metric_value in metric_result .items ():
2272
- tag = "eval/{}/{}" .format (eval_dataset .name , metric_name )
2273
- tf .logging .info ("%s at step %d: %.3f" , tag , global_step , metric_value )
2274
- summary .value .add (tag = tag , simple_value = metric_value )
2271
+ if isinstance (metric_result , tf .Summary ):
2272
+ tf .logging .info ("Precomputed summary at step %d" , global_step )
2273
+ summary_writer .add_summary (metric_result , global_step )
2274
+ else :
2275
+ for metric_name , metric_value in metric_result .items ():
2276
+ tag = "eval/{}/{}" .format (eval_dataset .name , metric_name )
2277
+ tf .logging .info ("%s at step %d: %.3f" , tag , global_step ,
2278
+ metric_value )
2279
+ summary .value .add (tag = tag , simple_value = metric_value )
2275
2280
summary_writer .add_summary (summary , global_step )
2276
2281
summary_writer .flush ()
2277
2282
You can’t perform that action at this time.
0 commit comments