Skip to content

Commit 5bba0ba

Browse files
jd7-trfacebook-github-bot
authored andcommitted
Back out "Add new argument for sharding type" (#3022)
Summary: Pull Request resolved: #3022 Rolling back the new `sharding_type` param. Other sharding types do not seem to work properly with the current `shard_quant_model` logic. Instead we are making changes to allow user to provide their own sharding plan for other sharding types (e.g. column-wise sharding). Original commit changeset: bebefd06f38b Original Phabricator Diff: D73540534 Reviewed By: aporialiao Differential Revision: D75727458 fbshipit-source-id: 622962c0025cf5f2103e1f163bdf8747feb5393f
1 parent 83f8bea commit 5bba0ba

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

torchrec/inference/modules.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ def shard_quant_model(
499499
device_memory_size: Optional[int] = None,
500500
constraints: Optional[Dict[str, ParameterConstraints]] = None,
501501
ddr_cap: Optional[int] = None,
502-
sharding_type: ShardingType = ShardingType.TABLE_WISE,
503502
) -> Tuple[torch.nn.Module, ShardingPlan]:
504503
"""
505504
Shard a quantized TorchRec model, used for generating the most optimal model for inference and
@@ -535,10 +534,6 @@ def shard_quant_model(
535534
quant_model = quantize_inference_model(module)
536535
sharded_model, _ = shard_quant_model(quant_model)
537536
"""
538-
# TODO(T220572301): remove after new sharding types are validated.
539-
assert (
540-
sharding_type == ShardingType.TABLE_WISE
541-
), "Only table-wise sharding is supported now."
542537

543538
if constraints is None:
544539
table_fqns = []
@@ -557,7 +552,7 @@ def shard_quant_model(
557552
constraints = {}
558553
for name in table_fqns:
559554
constraints[name] = ParameterConstraints(
560-
sharding_types=[sharding_type.value],
555+
sharding_types=[ShardingType.TABLE_WISE.value],
561556
compute_kernels=[EmbeddingComputeKernel.QUANT.value],
562557
)
563558

0 commit comments

Comments
 (0)