Skip to content

Commit 77f082d

Browse files
emlinfacebook-github-bot
authored andcommitted
check use_virtual_table attribute (#3000)
Summary: Pull Request resolved: #3000 before call table.use_virtual_table check if the table has this attribute first, since some test models might not have the latest code Reviewed By: kausv Differential Revision: D75427816 fbshipit-source-id: af6e73f4eac14f98567f56fb0b94115fead1b9c6
1 parent 89051ba commit 77f082d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

torchrec/quant/embedding_modules.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ def __init__(
379379
if table.name in table_names:
380380
raise ValueError(f"Duplicate table name {table.name}")
381381
table_names.add(table.name)
382-
key = (table.pooling, table.use_virtual_table)
382+
if hasattr(table, "use_virtual_table"):
383+
key = (table.pooling, table.use_virtual_table)
384+
else:
385+
key = (table.pooling, False)
383386
# pyre-ignore
384387
self._key_to_tables[key].append(table)
385388

@@ -781,7 +784,10 @@ def __init__( # noqa C901
781784
+ f" Violating case: {table.name}'s embedding_dim {table.embedding_dim} !="
782785
+ f" {self._embedding_dim}"
783786
)
784-
key = (table.data_type, table.use_virtual_table)
787+
if hasattr(table, "use_virtual_table"):
788+
key = (table.data_type, table.use_virtual_table)
789+
else:
790+
key = (table.data_type, False)
785791
self._key_to_tables[key].append(table)
786792
self._feature_splits: List[int] = []
787793
for key, emb_configs in self._key_to_tables.items():

0 commit comments

Comments
 (0)