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

Proportional Uneven Inference Sharding #2734

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions torchrec/distributed/quant_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ def sharded_tbes_weights_spec(
shard_sizes: List[int] = [table.local_rows, table.local_cols]
shard_offsets: List[int] = table_metadata.shard_offsets
s: str = "embedding_bags" if is_sqebc else "embeddings"
s = ("_embedding_module." if is_sqmcec else "") + s
unsharded_fqn_weight: str = f"{module_fqn}.{s}.{table_name}.weight"

sharded_fqn_weight: str = (
Expand Down
6 changes: 4 additions & 2 deletions torchrec/distributed/sharding/rw_sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,13 @@ def __init__(
self._world_size: int = world_size
self._num_features = num_features
self._feature_total_num_buckets: Optional[List[int]] = feature_total_num_buckets

self.feature_block_sizes: List[int] = []
for i, hash_size in enumerate(feature_hash_sizes):
block_divisor = self._world_size
if feature_total_num_buckets is not None:
if (
feature_total_num_buckets is not None
and embedding_shard_metadata is None
):
assert feature_total_num_buckets[i] % self._world_size == 0
block_divisor = feature_total_num_buckets[i]
self.feature_block_sizes.append(
Expand Down
Loading