-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Hi guys.
It looks like in HubApi method
func snapshot(from repo: Repo, revision: String = "main", matching globs: [String] = [], progressHandler: @escaping (Progress) -> Void = { _ in })
async throws -> URL { ... }specifically in it's "offline mode" part - the code does check integrity of existing files, but doesn't check if the list of existing files is "complete".
This leads to the issue when if for some reason a file went missing from a model directory - offline load of the model would still finish successfully, even though I believe it should return error in such case, because a file could be some very important file, like *.safetensors.
I could make a PR to fix this. The method could, after successful online download, remember filenames returned by try await getFilenames(from: repo, revision: revision, matching: globs) by putting them to some ./.another_metadata file. Then during offline load, if actual files in folder don't have any of remembered filenames - such offline load would be considered failed, so that the user could fallback to online load or at least understand that there is an issue.