bytedance / bytedance/1d-tokenizer
maskgit_vqgan‘s vq_loss is incorrect
- Dominant language
- Jupyter Notebook
- Stars
- 1.2k
- Forks
- 70
- PR merge metrics
- No merged PRs in 30d
Description
In the code, the vq_loss is incorrect, and the commitment_cost is placed in the wrong position.
https://github.com/bytedance/1d-tokenizer/blob/bdec006fb7226b309aaf3511956d0aafac30125a/modeling/modules/maskgit_vqgan.py#L296-L299
After correction:
In the code, the vq_loss is fixed, and the commitment_cost is placed in the correct position.
```
if return_loss:
loss = self.commitment_cost * torch.mean((z_q.detach() - hidden_states) ** 2) + torch.mean(
(z_q - hidden_states.detach()) ** 2
)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Open modeling/modules/maskgit_vqgan.py at lines 296-299 and inspect how vq_loss and commitment_cost are currently applied. Compare the calculation with the corrected expression in the issue, then run the repository's relevant checks; done means the loss uses the stated placement and weighting without unrelated changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100