TokenFlow
TokenFlow copied to clipboard
Fix get_latents_path to run on windows too
What
- Fix a frame counter in get_latents_path function.
- Update readme to instruct how to run using virtualenv on windows.
- Add some file's patterns to .gitignore file.
- Add kornia and av dependencies to requirements.txt
- Add requirements-torch.txt with cuda support.
Why
I was getting an error when the function tried to get the number of frames.
Description
Traceback (most recent call last):
File "C:\Projetos\TokenFlow\run_tokenflow_pnp.py", line 304, in <module>
run(config)
File "C:\Projetos\TokenFlow\run_tokenflow_pnp.py", line 283, in run
editor = TokenFlow(config)
File "C:\Projetos\TokenFlow\run_tokenflow_pnp.py", line 61, in __init__
self.latents_path = self.get_latents_path()
File "C:\Projetos\TokenFlow\run_tokenflow_pnp.py", line 122, in get_latents_path
n_frames = [int([x for x in latents_path[i].split('/') if 'nframes' in x][0].split('_')[1]) for i in range(len(latents_path))]
File "C:\Projetos\TokenFlow\run_tokenflow_pnp.py", line 122, in <listcomp>
n_frames = [int([x for x in latents_path[i].split('/') if 'nframes' in x][0].split('_')[1]) for i in range(len(latents_path))]
ValueError: invalid literal for int() with base 10: '2.1\\woman-running\\steps'
This is the corrected code for Windows OS in "run_tokenflow_pnp.py" instead of n_frames = [int([x for x in latents_path[i].split('/') if 'nframes' in x][0].split('')[1]) for i in range(len(latents_path))] write this: n_frames = [int(os.path.basename(x).split('')[1]) for x in latents_path if 'nframes' in x]
This is the corrected code for Windows OS in "run_tokenflow_pnp.py" instead of n_frames = [int([x for x in latents_path[i].split('/') if 'nframes' in x][0].split('')[1]) for i in range(len(latents_path))] write this: n_frames = [int(os.path.basename(x).split('')[1]) for x in latents_path if 'nframes' in x]
Thanks, That works. I guess I can remove regular expressions to make it simple.
still receiving an error in the new code.
Traceback (most recent call last):
File "D:\TokenFlow\run_tokenflow_pnp.py", line 302, in