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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
.DS_Store
tokenflow-results*/**
venv/
__pycache__/
*.pyc
latents/
data/**
!data/wolf.mp4
!data/woman-running.mp4
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@ For more see the [project webpage](https://diffusion-tokenflow.github.io).
<td><img src="assets/videos.gif"></td>

## Environment

Using conda
```
conda create -n tokenflow python=3.9
conda activate tokenflow
pip install -r requirements.txt
```

Using cpython Windows (powershell)
```powershell
python -m pip install virtualenv
python -m virtualenv venv
venv/Scripts/activate.ps1
pip install -r requirements.txt
pip install -r requirements-torch.txt
```

## Preprocess

Preprocess you video by running using the following command:
Expand Down
3 changes: 3 additions & 0 deletions requirements-torch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-i https://download.pytorch.org/whl/cu117
torch==2.0.1+cu117
torchvision==0.15.2+cu117
4 changes: 3 additions & 1 deletion run_tokenflow_pnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def get_latents_path(self):
latents_path = os.path.join(config["latents_path"], f'sd_{config["sd_version"]}',
Path(config["data_path"]).stem, f'steps_{config["n_inversion_steps"]}')
latents_path = [x for x in glob.glob(f'{latents_path}/*') if '.' not in Path(x).name]
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))]

n_frames = [int(os.path.basename(x).split('_')[1]) for x in latents_path if 'nframes_' in x]

latents_path = latents_path[np.argmax(n_frames)]
self.config["n_frames"] = min(max(n_frames), config["n_frames"])
if self.config["n_frames"] % self.config["batch_size"] != 0:
Expand Down