-
Notifications
You must be signed in to change notification settings - Fork 744
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
Issue with load_model on Windows platform #97
Comments
👋 Hello @Roman-Rudensky, thank you for leaving an issue on Roboflow Notebooks. 🐞 Bug reportsIf you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines. If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository. 💬 Get in touchDo you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there. To ask questions about Notebooks, head over to the GitHub Discussions section of this repository. |
The bug is caused by different implement of tempfile between linux and windows. |
Leaving this here for others, I went to the slconfig.py file (located in GroundingDino/groundingdino/util/slconfig.py and added delete=False to line 81 The line now reads: temp_config_file = tempfile.NamedTemporaryFile(dir=temp_config_dir, suffix=".py", delete=False) |
Search before asking
Notebook name
zero-shot-object-detection-with-grounding-dino.ipynb
Bug
Environment
Minimal Reproducible Example
No response
Additional
The issue happens because shutil.copyfile() attempts to open tempfile which is already opened. On Windows platform this raises Permission Error.
Here's how I could solve that in slconfig.py (lines 80-83):
80 with tempfile.TemporaryDirectory() as temp_config_dir:
81 temp_config_file = tempfile.NamedTemporaryFile(dir=temp_config_dir, suffix=".py") # here temp_config_file is opened
82 temp_config_name = osp.basename(temp_config_file.name)
# on Windows attempt to open temp_config_file by shutil raises IOError: [Errno 13] Permission denied:
# close file before using shutil
temp_config_file.close()
83 shutil.copyfile(filename, osp.join(temp_config_dir, temp_config_name))
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: