omerbt / TokenFlow

Official Pytorch Implementation for "TokenFlow: Consistent Diffusion Features for Consistent Video Editing" presenting "TokenFlow" (ICLR 2024)
https://diffusion-tokenflow.github.io
MIT License
1.52k stars 134 forks source link

"ValueError: max() arg is an empty sequence" when trying to run via jupyterlab env #37

Open bstnhnsl opened 8 months ago

bstnhnsl commented 8 months ago

I'm trying to tokenflow via jupyterlab env.

On the last step, when running run_tokenflow_pnp.py, I get this error:

Traceback (most recent call last):
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 301, in <module>
    run(config)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 280, in run
    editor = TokenFlow(config)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 62, in __init__
    self.paths, self.frames, self.latents, self.eps = self.get_data()
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 183, in get_data
    eps = self.get_ddim_eps(latents, range(self.config["n_frames"])).to(torch.float16).to(self.device)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 187, in get_ddim_eps
    noisest = max([int(x.split('_')[-1].split('.')[0]) for x in glob.glob(os.path.join(self.latents_path, f'noisy_latents_*.pt'))])
ValueError: max() arg is an empty sequence
Zeldalina commented 3 months ago

I'm trying to tokenflow via jupyterlab env.

On the last step, when running run_tokenflow_pnp.py, I get this error:

Traceback (most recent call last):
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 301, in <module>
    run(config)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 280, in run
    editor = TokenFlow(config)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 62, in __init__
    self.paths, self.frames, self.latents, self.eps = self.get_data()
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 183, in get_data
    eps = self.get_ddim_eps(latents, range(self.config["n_frames"])).to(torch.float16).to(self.device)
  File "/home/jovyan/token-flow/run_tokenflow_pnp.py", line 187, in get_ddim_eps
    noisest = max([int(x.split('_')[-1].split('.')[0]) for x in glob.glob(os.path.join(self.latents_path, f'noisy_latents_*.pt'))])
ValueError: max() arg is an empty sequence

因为你没有先执行preprocess.py代码,导致路径os.path.join(self.latents_path, f'noisylatents*.pt')上的文件不存在。你应该先执行preprocess.py代码,再执行run_tokenflow_pnp.py。