Skip to content

Commit

Permalink
should be using 1 - probs for score
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jan 19, 2023
1 parent a076be0 commit 46ddd35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions muse_maskgit_pytorch/muse_maskgit_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,15 @@ def generate(
ids
)

scores = 1 - logits.gather(2, pred_ids[..., None])
probs_without_temperature = logits.softmax(dim = -1)

scores = 1 - probs_without_temperature.gather(2, pred_ids[..., None])
scores = rearrange(scores, '... 1 -> ...')

if not can_remask_prev_masked:
# without doing MLM type 15% random or non-masked predictions
# non-masked tokens may not get correct logits (scores)
# but not sure

scores = scores.masked_fill(~is_mask, -1e5)
else:
assert self.no_mask_token_prob > 0., 'without training with some of the non-masked tokens forced to predict, not sure if the logits will be meaningful for these token'

# get ids

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 = 'muse-maskgit-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.21',
version = '0.0.22',
license='MIT',
description = 'MUSE - Text-to-Image Generation via Masked Generative Transformers, in Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 46ddd35

Please sign in to comment.