greyelf
greyelf

Reputation: 51

Profiling Tensorflow Estimators

I'm busy trying to profile the tensorflow BERT code to see if it's fast enough for a particular use case.

I need to determine the speed of predictions. Now, as I understand, one would add a profiler or a run_metadata object to the session.Run options. However, BERT is using the new Estimator API.

How does one profile the Estimators? Is that possible?

Update:

The Tensorflow team showed me here that one could attach a ProfilerHook to an estimator:

hooks = [tf.train.ProfilerHook(save_steps=1, output_dir=model_dir)]
estimator.predict(..., hooks=hooks)

This produces a trace file, but the trace does not work.

Error : Couldn't create an importer for the provided eventData.
at Import.createImporter_ (chrome://tracing/tracing.js:1300:2071)
at addImportStage (chrome://tracing/tracing.js:1295:167)
at Task.run (chrome://tracing/tracing.js:2307:95)
at runAnother (chrome://tracing/tracing.js:2310:371)
at runTask (chrome://tracing/tracing.js:2286:57)
at processIdleWork (chrome://tracing/tracing.js:2291:116)
at window.requestIdleCallback.timeout (chrome://tracing/tracing.js:2284:81)

Upvotes: 1

Views: 923

Answers (1)

Pavan
Pavan

Reputation: 11

If you have used tf.estimator files of type timeline-.js will be created. load any of these timeline-.js in chrome://tracing/ to see the trace file You will find the timeline-.js files in the model directory.

Upvotes: 1

Related Questions