Skip to content

Commit 3c1d071

Browse files
committed
Simplify frame counter in run_tokenflow_pnp
1 parent 383808d commit 3c1d071

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

run_tokenflow_pnp.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import glob
22
import os
3-
import re
43
import numpy as np
54
import cv2
65
from pathlib import Path
@@ -117,8 +116,7 @@ def get_latents_path(self):
117116
Path(config["data_path"]).stem, f'steps_{config["n_inversion_steps"]}')
118117
latents_path = [x for x in glob.glob(f'{latents_path}/*') if '.' not in Path(x).name]
119118

120-
pattern = re.compile(".*nframes_([0-9]+)")
121-
n_frames = [int(g[1]) for g in [pattern.match(latents_path[i]) for i in range(len(latents_path))] if g]
119+
n_frames = [int(os.path.basename(x).split('')[1]) for x in latents_path if 'nframes' in x]
122120

123121
latents_path = latents_path[np.argmax(n_frames)]
124122
self.config["n_frames"] = min(max(n_frames), config["n_frames"])

0 commit comments

Comments
 (0)