Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M metaseq
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 95
    • Issues 95
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 41
    • Merge requests 41
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • metaseq
  • Merge requests
  • !478
An error occurred while fetching the assigned milestone of the selected merge_request.

Re-add supports_rename and rename to PathManager

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge andy/readd_supports_rename into main 2 years ago
  • Overview 6
  • Commits 2
  • Pipelines 0
  • Changes 1

Created by: andrewPoulton

Addresses #477 (closed), and also adds rename method to PathManager which is also called in checkpoint_utils.torch_persistent_save.

Currently untested, @Xirider should run in his env, as he found the bug.

Compare
  • main (base)

and
  • latest version
    127153dd
    2 commits, 2 years ago

1 file
+ 12
- 0

    Preferences

    File browser
    Compare changes
metaseq/file_io/common/__init__.py
+ 12
- 0
  • View file @ 127153dd

  • Edit in single-file editor

  • Open in Web IDE


@@ -741,6 +741,18 @@ class PathManager:
return True
return False
def supports_rename(self, path: str) -> bool:
# PathManager doesn't yet support renames
return not self.path_requires_pathmanager(path)
def rename(self, src: str, dst: str) -> None:
if self.supports_rename(src):
os.rename(src, dst)
else:
raise ValueError(
f"Path {src} requires PathHandler, and so doesn't support renaming."
)
# pyre-fixme[24]: Generic type `os.PathLike` expects 1 type parameter.
def __get_path_handler(self, path: Union[str, os.PathLike]) -> PathHandler:
"""
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: andy/readd_supports_rename

Menu

Explore Projects Groups Snippets