Skip to content

Upload only files that have changed since last upload in upload_folder #1576

@Wauplin

Description

@Wauplin

Related to discussion that happened in huggingface/diffusers#4128 but implementing this would be beneficial in more cases.

The idea would be to have a modified_after: datetime | int | None = None param for upload_folder. Instead of listing and uploading all files in the folder, we would upload only files that have being changed after modified_after. This would allow to make regular uploads of a folder in a more optimized way.

Note: LFS files are never re-uploaded to the Hub. This optimization would be more to:

  • have less files in the /commit payload
  • don't push existing text files again
  • save the time it takes to compute the sha256 of each file (even large ones)
    This would come at the cost of checking disk info for each file. Should still be quicker than reading the content of the files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions