-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsafe save_weights/load_weights method #27
Comments
A https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile |
Wow that is cool ahah. |
Good point! Would you mind to create a PR? |
I actually just fixed it in my local clone by saving the weights in memory instead of on disk. According to this, even a 50-layer ResNet uses around ~168MB, so I suppose keeping them in memory will be just fine for most cases? The weights are saved and loaded immediately after, the lr search anyway. In this case, I made a pull request #28. |
In LRFinder.find() and LRFinder.find_generator(), there is a call to the following functions:
This is unsafe: In the case where several python processes running LRFinder in parallel, they will all attempt to access the same file, mixing weights between processess...
A random file name should instead be generated every time, and it should be checked whether this random file name already exists or not. It should be noted that, one should prevent different processes from generating the same random file name if they are executed at the same time (this can be a problem if random uses datetime as seed).
The text was updated successfully, but these errors were encountered: