Hi! I tried creating a project based on the "topviewmouse" model from the model zoo by calling create_pretrained_project() exactly as in the Google Collab demo notebook. It worked for me last week, but this week I got a "file not found error" when DLC tries to unzip the .tgz file downloaded from Huggingface. I didn't update my code since last week.
In the current modelzoo_urls.yaml, the commit ID for the topviewmouse model is a7d7df40c3307a3c7a0ceeb2593d46a783235b28, whereas the file created here in download_hugginface_model() seems to be placed in a subfolder that contains the commit ID 670ba95203d75b9533d6595d5cc05ce5f13d5163, hence the FileNotFoundError below.
I would guess that something changed on Hugginface (a new commit?), but was not updated in modelzoo_urls.yaml. I was able to fix the problem by replacing the commit ID starting with a7d7 with the one starting with 670b in modelzoo_urls.yaml.
Full error traceback:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[12], line 1
----> 1 config_path, train_config_path = deeplabcut.create_pretrained_project(
2 project_name,
3 your_name,
4 [video_path],
5 videotype=videotype,
6 model=model2use,
7 analyzevideo=True,
8 createlabeledvideo=False,
9 copy_videos=True, #must leave copy_videos=True
10 )
File ~/mambaforge/envs/dlc/lib/python3.10/site-packages/deeplabcut/create_project/modelzoo.py:261, in create_pretrained_project(project, experimenter, videos, model, working_directory, copy_videos, videotype, analyzevideo, filtered, createlabeledvideo, trainFraction)
259 # Download the weights and put then in appropriate directory
260 print("Downloading weights...")
--> 261 download_huggingface_model(model, train_dir)
263 pose_cfg = deeplabcut.auxiliaryfunctions.read_plainconfig(path_train_config)
264 pose_cfg["dataset_type"] = "imgaug"
File ~/mambaforge/envs/dlc/lib/python3.10/site-packages/dlclibrary/dlcmodelzoo/modelzoo_download.py:88, in download_huggingface_model(modelname, target_dir, remove_hf_folder)
80 hf_path = os.path.join(
81 hf_folder,
82 "snapshots",
83 str(neturls[modelname + "_commit"]),
84 targzfn,
85 )
87 filename = os.path.join(target_dir, hf_path)
---> 88 with tarfile.open(filename, mode="r:gz") as tar:
89 for member in tar:
90 if not member.isdir():
File ~/mambaforge/envs/dlc/lib/python3.10/tarfile.py:1817, in TarFile.open(cls, name, mode, fileobj, bufsize, **kwargs)
1815 else:
1816 raise CompressionError("unknown compression type %r" % comptype)
-> 1817 return func(name, filemode, fileobj, **kwargs)
1819 elif "|" in mode:
1820 filemode, comptype = mode.split("|", 1)
File ~/mambaforge/envs/dlc/lib/python3.10/tarfile.py:1863, in TarFile.gzopen(cls, name, mode, fileobj, compresslevel, **kwargs)
1860 raise CompressionError("gzip module is not available") from None
1862 try:
-> 1863 fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
1864 except OSError as e:
1865 if fileobj is not None and mode == 'r':
File ~/mambaforge/envs/dlc/lib/python3.10/gzip.py:174, in GzipFile.__init__(self, filename, mode, compresslevel, fileobj, mtime)
172 mode += 'b'
173 if fileobj is None:
--> 174 fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
175 if filename is None:
176 filename = getattr(fileobj, 'name', '')
FileNotFoundError: [Errno 2] No such file or directory: '/data0/HL/dlc-workdir/hl3-fail-H-2023-07-31/dlc-models/iteration-0/hl3-failJul31-trainset95shuffle1/train/models--mwmathis--DeepLabCutModelZoo-SuperAnimal-TopViewMouse/snapshots/a7d7df40c3307a3c7a0ceeb2593d46a783235b28/DLC_ma_supertopview5k_resnet_50_iteration-0_shuffle-1.tar.gz'
Hi! I tried creating a project based on the "topviewmouse" model from the model zoo by calling
create_pretrained_project()
exactly as in the Google Collab demo notebook. It worked for me last week, but this week I got a "file not found error" when DLC tries to unzip the .tgz file downloaded from Huggingface. I didn't update my code since last week.In the current modelzoo_urls.yaml, the commit ID for the topviewmouse model is
a7d7df40c3307a3c7a0ceeb2593d46a783235b28
, whereas the file created here in download_hugginface_model() seems to be placed in a subfolder that contains the commit ID 670ba95203d75b9533d6595d5cc05ce5f13d5163, hence the FileNotFoundError below.I would guess that something changed on Hugginface (a new commit?), but was not updated in
modelzoo_urls.yaml
. I was able to fix the problem by replacing the commit ID starting with a7d7 with the one starting with 670b inmodelzoo_urls.yaml
.Full error traceback: