-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f52db2
commit f5e90a2
Showing
2 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f5e90a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've come across a race condition in this code. If two processes are loading a model at the same time, the following can happen:
The simplest solution I found was to remove the try block at 328 entirely and only use the "fallback" route.
I'm not sure if there's another race if Alice unlinks the file while Bob is still constructing the H5IOStore; I don't know how the zipfile library handles that situation.
I don't understand the logic for why the weights need to be extracted to a location on the filesystem, but if that is important, then it might make sense to mangle the name of the generated file to avoid collisions. (As it is, all processes create a file with the exact same name.)
I would try to use a lock when loading models, but this is clunky (the user shouldn't have to juggle locks to load a file) and unworkable on a cluster or other distributed resource.