Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReturnnForwardJobV2, wait for checkpoint a bit #464

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions returnn/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,20 @@ def create_files(self):

# check here if model actually exists
if self.model_checkpoint is not None:
assert os.path.exists(
_get_model_path(self.model_checkpoint).get_path()
), f"Provided model checkpoint does not exists: {self.model_checkpoint}"
import time

num_tries = 0
while True:
if os.path.exists(_get_model_path(self.model_checkpoint).get_path()):
break
num_tries += 1
if num_tries > 10:
raise Exception(f"Provided model checkpoint does not exists: {self.model_checkpoint}")
print(
f"Provided model checkpoint does not exists: {self.model_checkpoint}. "
f"Waiting for 3s (try {num_tries})..."
)
time.sleep(3)

def run(self):
"""run"""
Expand Down
Loading