Skip to content

Commit

Permalink
[fix] get_temp_dir function may return different directory.
Browse files Browse the repository at this point in the history
And filesystem may be slower than files asserting check.
  • Loading branch information
MoFHeka committed Jan 30, 2024
1 parent c689540 commit e39ba45
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import os
import numpy as np
import shutil
from time import sleep

import tensorflow as tf

Expand Down Expand Up @@ -407,6 +408,7 @@ def call(self, x):
def check_TFRADynamicEmbedding_directory(save_dir,
save_it=None,
should_be_exist=True):
sleep(4) # Wait for filesystem operation
hvd_size = hvd.size()
if hvd_size <= 1:
hvd_size = 1
Expand Down Expand Up @@ -439,6 +441,10 @@ def check_TFRADynamicEmbedding_directory(save_dir,
new_de_opt_compared = {}

save_dir = self.get_temp_dir()
# Need to use same directory when horovod save
save_dir = hvd.broadcast_object(save_dir,
root_rank=0,
name=f'{__file__}_broadcast_save_dir')

model = NoCompileModel('ones')
base_opt = Adam(1.0)
Expand Down

0 comments on commit e39ba45

Please sign in to comment.