dvt icon indicating copy to clipboard operation
dvt copied to clipboard

Downloading dvt_detect_shots.pt error

Open jdchart opened this issue 1 year ago • 2 comments

Hi there!

Great work on this, this is excellent.

Reporting an error that I did manage to fix on my own but thought you should be aware of.

Heads up: I'm running dvt as a git submodule which I then install into my virtual environment (which i suspect could be linked to the problem).

I was trying to run dvt.AnnoShotBreaks(), and dvt attempted to download this file : https://github.com/distant-viewing/dvt/releases/download/0.0.1/dvt_detect_shots.pt (I'm assuming a ML model?)

I was getting the following error:

Traceback (most recent call last):
  File "/Users/jacob/Documents/Git Repos/plozevet-archive/Scripts/DVT-Tests/breakpoint-test.py", line 23, in <module>
    process(params)
  File "/Users/jacob/Documents/Git Repos/plozevet-archive/Scripts/DVT-Tests/breakpoint-test.py", line 19, in process
    anno_breaks = dvt.AnnoShotBreaks()
  File "/Users/jacob/Documents/Git Repos/plozevet-archive/venv/lib/python3.10/site-packages/dvt/shots.py", line 26, in __init__
    model_path = _download_file("dvt_detect_shots.pt")
  File "/Users/jacob/Documents/Git Repos/plozevet-archive/venv/lib/python3.10/site-packages/dvt/utils.py", line 135, in _download_file
    download_url_to_file(url, cached_file, hash_prefix, progress=True)
  File "/Users/jacob/Documents/Git Repos/plozevet-archive/venv/lib/python3.10/site-packages/torch/hub.py", line 625, in download_url_to_file
    f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir)
  File "/usr/local/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 559, in NamedTemporaryFile
    file = _io.open(dir, mode, buffering=buffering,
  File "/usr/local/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 556, in opener
    fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/local/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 256, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jacob/.cache/torch/hub/checkpoints/tmps3k5bm1g'

In the end I went and manually created the path /torch/hub/checkpoints/. Sounds like a problem that could be easily resolved with a Path(dir).mkdir(parents=True) ? Or maybe the issue is my submodule/venv setup.

Anyway, all working my end and having fun with the toolkit!

jdchart avatar Jun 23 '23 14:06 jdchart

I think this is the same problem as #34 and is resolved by the adjustment to download logic in #36 which has been merged to main

rlskoeser avatar Jul 14 '23 10:07 rlskoeser

Hello ! Thanks, and sorry for the duplication!

jdchart avatar Jul 17 '23 07:07 jdchart