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

Create all necessary parent directories when saving models #534

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

juliabeliaeva
Copy link
Contributor

Fixes #525

@juliabeliaeva juliabeliaeva requested a review from zaleslaw April 16, 2023 21:52
@zaleslaw
Copy link
Collaborator

Thanks @juliabeliaeva I will check your PR and write the answer

@@ -825,20 +825,17 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel
when (writingMode) {
WritingMode.FAIL_IF_EXISTS -> {
check(!modelDirectory.exists()) { "The directory exists on path $pathToModelDirectory, please be careful it could contain valuable model! Change this mode to OVERRIDE if you want to override this directory." }
Files.createDirectories(modelDirectory.toPath())
Copy link
Collaborator

Choose a reason for hiding this comment

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

I need to say, that this is not the same code with replacement of createDirectories + mkdir => mkdirs due to reducing number of checks and supported exceptions

But I agree, it should be consistent in both files

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 can replace mkdirs with Files.createDirectories if you think it's a better fit (but I don't think we need both).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow, really, double creation of the last directory, ok, I will check and return

@zaleslaw zaleslaw merged commit d0c3df5 into Kotlin:release_0.5 Apr 24, 2023
@juliabeliaeva juliabeliaeva modified the milestone: 0.5.2 May 8, 2023
@juliabeliaeva juliabeliaeva deleted the create-parent-dirs branch May 8, 2023 17:52
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.

2 participants