valeoai / Maskgit-pytorch

MIT License
145 stars 15 forks source link

Questions about the mask scheduling function #17

Closed stein-666 closed 1 month ago

stein-666 commented 1 month ago

Hi, thanks for your great open-source work! I have two questions about the mask scheduler initialization when running the inference.

In your code, the mask scheduling function is set to arccos: val_to_mask = torch.arccos(r) / (math.pi * 0.5). However, in the original MaskGIT paper, it is set to the cos function. I’m not sure about the purpose of this difference in the code. When you initialize the input of the mask scheduling function, you choose r = torch.linspace(1, 0, step). But the paper claims that the input of the function should be 0/T, 1/T…(T-1)/T, which is different from torch.linspace(1, 0, step)=0/(step-1), 1/(step-1)...1. I’m not sure if I have misunderstood the paper.

llvictorll commented 1 month ago

Hello, thank for the question,

The arccos scheduler masks, on average, a larger portion of the image. Please see the technical report.

The line r = torch.linspace(1, 0, step) is slightly different, but I think it is a minor detail. Having T = step + 1 should result in the same scheduler.

Best regards,

Victor

stein-666 commented 1 month ago

Thank you for your reply. My question has been resolved.