Skip to content

Commit

Permalink
avoid non-exist protobuf field
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-gecheng committed Dec 26, 2024
1 parent 4d17473 commit 9783bb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tzrec/features/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,12 @@ def dense_embedding_config(
) -> Optional[DenseEmbeddingConfig]:
"""Get DenseEmbeddingConfig of the feature."""
if not self.is_sparse:
if self.config.HasField("autodis") and self.config.HasField("mlp"):
if (
hasattr(self.config, "autodis")
and self.config.HasField("autodis")
and hasattr(self.config, "mlp")
and self.config.HasField("mlp")
):
raise ValueError(
f"feature [{self.name}] can not be configured in\
both autodis and mlp embedding."
Expand Down

0 comments on commit 9783bb5

Please sign in to comment.