Skip to content
Snippets Groups Projects

path-token-fix

Merged Frank Sauerburger requested to merge path-token-fix into master
All threads resolved!

For some systems such as lxplus, directories may have a dot in their path. As such, the current code can not save or import the fit properly.

Solution/simple test:

fold_i = 0
path = "/system.directory/path/to/model"
path_token = path.rsplit("/", 1)
file_token = path_token[-1].rsplit(".", 1)

if len(file_token) == 1:
    file_token.append(f"fold_{fold_i}")
else:
    file_token.insert(-1, f"fold_{fold_i}")

if len(path_token) == 1:
    path_token = [".".join(file_token)]
else:
    path_token = [path_token[0]] + [".".join(file_token)]

print("/".join(path_token))

Tests:

path = "/system.directory/path/to/model" -> /system.directory/path/to/model.fold_0

path = "/system.directory/path/to/model.h5" -> /system.directory/path/to/model.fold_0.h5

path = "/system_directory/path/to/model" -> /system_directory/path/to/model.fold_0

path = "/system_directory/path/to/model.h5" -> /system_directory/path/to/model.fold_0.h5

path = "model" -> model.fold_0

path = "model.h5" -> model.fold_0.h5

Edited by Frank Sauerburger

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Frank SauerburgerFrank Sauerburger 2 years ago (Sep 30, 2022 12:27pm UTC)

Merge details

  • Changes merged into master with 21ea2cbd.
  • Did not delete the source branch.

Pipeline #12728 passed

Pipeline passed for 21ea2cbd on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Frank Sauerburger resolved all threads

    resolved all threads

  • Frank Sauerburger marked this merge request as ready

    marked this merge request as ready

  • Please register or sign in to reply
    Loading