Fix logic in train CLI timing eval on GPU (#5387)

Run CPU timing in first iteration only
This commit is contained in:
adrianeboyd 2020-05-01 12:05:33 +02:00 committed by GitHub
parent 148b036e0c
commit c045a9c7f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -456,7 +456,7 @@ def train(
gpu_wps = nwords / (end_time - start_time) gpu_wps = nwords / (end_time - start_time)
# Only evaluate on CPU in the first iteration (for # Only evaluate on CPU in the first iteration (for
# timing) if GPU is enabled # timing) if GPU is enabled
if i >= 1: if i == 0:
with Model.use_device("cpu"): with Model.use_device("cpu"):
nlp_loaded = util.load_model_from_path(epoch_model_path) nlp_loaded = util.load_model_from_path(epoch_model_path)
for name, component in nlp_loaded.pipeline: for name, component in nlp_loaded.pipeline: