Fix Nanocodec's FSQ codes function: tensor creation misplacement#15405
Fix Nanocodec's FSQ codes function: tensor creation misplacement#15405Ferdydh wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Conversation
Bug: torch.arange always creates a tensor on cpu, but the FSQ might be moved to another device, crashing codes function when called (because of self.decode function: indices//self.dim_base_index...) Fix: just move to device when creating tensor. Signed-off-by: Ferdydh <ferdydh.hadiwijaya@tum.de>
|
Most of the properties of this class return native python types not tensors. @rlangman, what is self.codes supposed to return and should it be a torch.tensor? |
From what I remember these functions are just there to help people visualize what the codebook structure looks like. They would never be used during training or inference. The reason this can throw an error is because the The way it is implemented right now, I think the change here is appropriate. |
Bug: torch.arange always creates a tensor on cpu, but the FSQ might be moved to another device, crashing codes function when called (because of self.decode function: indices//self.dim_base_index...)
Fix: just move to device when creating tensor.
Important
The
Update branchbutton must only be pressed in very rare occassions.An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.
What does this PR do ?
Add a one line overview of what this PR aims to accomplish.
Collection: [Note which collection this PR will affect]
Changelog
Usage
# Add a code snippet demonstrating how to use thisGitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information