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

bug fix: generate directory if path not exist in compile_mmap_model #281

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

jianhao2016
Copy link
Contributor

Issue #, if available: N/A

Description of changes:
Generate directory if path not exist when saving a XLinearModel.

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

@@ -144,6 +144,8 @@ def compile_mmap_model(cls, npz_folder, mmap_folder):
"""
import shutil

if not path.exists(mmap_folder):
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using os.makedirs(mmap_folder, exist_ok=True)?
https://docs.python.org/3/library/os.html#os.makedirs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following the convention of previous changes, in that case should we change https://github.com/amzn/pecos/blob/mainline/pecos/xmc/xlinear/model.py#L98 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated both lines. Please check revision.

Copy link
Contributor

@OctoberChang OctoberChang left a comment

Choose a reason for hiding this comment

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

LGTM

@jianhao2016 jianhao2016 merged commit 845ca6a into amzn:mainline Feb 23, 2024
25 checks passed
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.

3 participants