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.