Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag KJT related part to sc.INPUT_DIST #2678

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions torchrec/quant/embedding_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,23 @@ def _fx_trec_unwrap_kjt(
return indices.int(), offsets.int()


@torch.fx.wrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line not needed

def _fx_trec_unwrap_jt(
jt: JaggedTensor,
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Forced conversions to support TBE
CPU - int32 or int64, offsets dtype must match
GPU - int32 only, offsets dtype must match
Comment on lines +309 to +310
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you provide reference on this dtype?

"""
indices = jt.values()
offsets = jt.offsets()
if jt.device().type == "cpu":
return indices, offsets.type(dtype=indices.dtype)
else:
return indices.int(), offsets.int()


class EmbeddingBagCollection(EmbeddingBagCollectionInterface, ModuleNoCopyMixin):
"""
This class represents a reimplemented version of the EmbeddingBagCollection
Expand Down
Loading