Skip to content

Commit 9720f01

Browse files
authored
Merge pull request #11 from pytorch-tpu/tengyifei-patch-1
Support training without profiling
2 parents c94fb9d + 7872e17 commit 9720f01

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/text_to_image/train_text_to_image_xla.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ def start_training(self):
7777
dataloader_exception = True
7878
print(e)
7979
break
80-
if step == measure_start_step and PROFILE_DIR is not None:
81-
xm.wait_device_ops()
82-
xp.trace_detached('localhost:9012', PROFILE_DIR, duration_ms=args.profile_duration)
83-
last_time = time.time()
80+
if step == measure_start_step:
81+
last_time = time.time()
82+
if PROFILE_DIR is not None:
83+
xm.wait_device_ops()
84+
xp.trace_detached('localhost:9012', PROFILE_DIR, duration_ms=args.profile_duration)
8485
loss = self.step_fn(batch["pixel_values"], batch["input_ids"])
8586
self.global_step += 1
8687
xm.mark_step()

0 commit comments

Comments
 (0)