Skip to content
Merged
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
14 changes: 12 additions & 2 deletions tensorrt_llm/_torch/modules/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,19 @@ def __init__(
else:
self.padding_size = 0

# Linear re-shards only the dim selected by tensor_parallel_mode, so
# only that dim may be passed as local*tp (to carry the ceil-div
# padding); the other dim must be the true full size — Linear keeps it
# as-is, and quant_method.create_weights sizes the (packed) quantized
# weight and scales from it.
in_features_full = (local_in_features * tp_size if tensor_parallel_mode
== TensorParallelMode.ROW else embedding_dim)
out_features_full = (local_out_features *
tp_size if tensor_parallel_mode
== TensorParallelMode.COLUMN else num_embeddings)
super().__init__(
local_in_features * tp_size,
local_out_features * tp_size,
in_features_full,
out_features_full,
bias=False,
dtype=dtype,
mapping=mapping,
Expand Down
Loading