Skip to content

fix: add condition to avoid error when 'model_dir' is None #403

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

Merged
merged 1 commit into from
Oct 16, 2020
Merged

fix: add condition to avoid error when 'model_dir' is None #403

merged 1 commit into from
Oct 16, 2020

Conversation

chuyang-deng
Copy link
Contributor

@chuyang-deng chuyang-deng commented Oct 15, 2020

Issue #, if available:
aws/sagemaker-python-sdk#1954

Description of changes:
Check model_dir is not None or False before checking its content.
When TensorFlow.model_dir is set to False, the current logic will raise error.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-tensorflow-training-container-pr
  • Commit ID: 62a89fe
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-tensorflow-training-toolkit-pr
  • Commit ID: 62a89fe
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@@ -204,7 +204,7 @@ def _log_model_missing_warning(model_dir):


def _model_dir_with_training_job(model_dir, job_name):
if model_dir.startswith("/opt/ml"):
if model_dir and model_dir.startswith("/opt/ml"):
return model_dir
else:
return "{}/{}/model".format(model_dir, job_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string?

Suggested change
return "{}/{}/model".format(model_dir, job_name)
return f"{model_dir}/{job_name}/model"

@chuyang-deng chuyang-deng merged commit b6772fe into aws:tf-2 Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants