Skip to content

Commit

Permalink
make sure critic is inferenced without grad and eval is turn on
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Oct 28, 2022
1 parent b9de5d9 commit c1b1236
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion phenaki_pytorch/phenaki_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,9 @@ def __init__(

# sampling

if exists(critic):
critic = critic.eval()

self.critic = critic
self.steps = steps
self.sample_temperature = sample_temperature
Expand Down Expand Up @@ -1060,7 +1063,8 @@ def sample(

if not is_last_step:
if exists(self.critic):
scores = self.critic(video_token_ids)
with torch.no_grad():
scores = self.critic(video_token_ids)

noise = K * (uniform(scores.shape, device) - 0.5) * (steps_til_x0 / self.steps)
scores = scores + noise
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'phenaki-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.7',
version = '0.0.8',
license='MIT',
description = 'Phenaki - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit c1b1236

Please sign in to comment.