Issue with load_model on Windows platform
@SkalskiP is already working on this.
Since Apr 7, 2023.
- Dominant language
- Jupyter Notebook
- Stars
- 9.7k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Search before asking
- I have searched the Roboflow Notebooks issues and found no similar bug report.
Notebook name
zero-shot-object-detection-with-grounding-dino.ipynb
Bug

Environment
- Local
- OS Windows10
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?
- Yes I'd like to help by submitting a PR!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.