Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_latents_path to run on windows too #10

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rodjjo
Copy link

@rodjjo rodjjo commented Sep 5, 2023

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'

@rodjjo rodjjo changed the title Fix get_latents_path function frame counter Fix get_latents_path to run on windows too Sep 5, 2023
@argentinox
Copy link

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]

@rodjjo
Copy link
Author

rodjjo commented Sep 7, 2023

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.

@nikopueringer
Copy link

nikopueringer commented Sep 7, 2023

still receiving an error in the new code.

Traceback (most recent call last):
File "D:\TokenFlow\run_tokenflow_pnp.py", line 302, in
run(config)
File "D:\TokenFlow\run_tokenflow_pnp.py", line 281, in run
editor = TokenFlow(config)
File "D:\TokenFlow\run_tokenflow_pnp.py", line 60, in init
self.latents_path = self.get_latents_path()
File "D:\TokenFlow\run_tokenflow_pnp.py", line 119, in get_latents_path
n_frames = [int(os.path.basename(x).split('')[1]) for x in latents_path if 'nframes' in x]
File "D:\TokenFlow\run_tokenflow_pnp.py", line 119, in
n_frames = [int(os.path.basename(x).split('')[1]) for x in latents_path if 'nframes' in x]
ValueError: empty separator

@rodjjo
Copy link
Author

rodjjo commented Sep 7, 2023

ValueError: empty separator

Try again, I changed argentinox suggestion a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants