codeShare commited on
Commit
1883765
·
verified ·
1 Parent(s): af2db74

Update wdv3_timm.py

Browse files
Files changed (1) hide show
  1. wdv3_timm.py +9 -4
wdv3_timm.py CHANGED
@@ -121,6 +121,11 @@ class ScriptOptions:
121
 
122
  def main(opts: ScriptOptions):
123
  repo_id = MODEL_REPO_MAP.get(opts.model)
 
 
 
 
 
124
 
125
  image_dir = Path(opts.image_dir).resolve()
126
  for image_path in os.findall(image_dir):
@@ -129,10 +134,10 @@ def main(opts: ScriptOptions):
129
  if not image_path.is_file(): raise FileNotFoundError(f"Image file not found: {image_path}")
130
 
131
 
132
- print(f"Loading model '{opts.model}' from '{repo_id}'...")
133
- model: nn.Module = timm.create_model("hf-hub:" + repo_id).eval()
134
- state_dict = timm.models.load_state_dict_from_hf(repo_id)
135
- model.load_state_dict(state_dict)
136
 
137
  print("Loading tag list...")
138
  labels: LabelData = load_labels_hf(repo_id=repo_id)
 
121
 
122
  def main(opts: ScriptOptions):
123
  repo_id = MODEL_REPO_MAP.get(opts.model)
124
+ print(f"Loading model '{opts.model}' from '{repo_id}'...")
125
+ model: nn.Module = timm.create_model("hf-hub:" + repo_id).eval()
126
+ state_dict = timm.models.load_state_dict_from_hf(repo_id)
127
+ model.load_state_dict(state_dict)
128
+
129
 
130
  image_dir = Path(opts.image_dir).resolve()
131
  for image_path in os.findall(image_dir):
 
134
  if not image_path.is_file(): raise FileNotFoundError(f"Image file not found: {image_path}")
135
 
136
 
137
+
138
+
139
+
140
+
141
 
142
  print("Loading tag list...")
143
  labels: LabelData = load_labels_hf(repo_id=repo_id)