Skip to content

Commit

Permalink
- Fix TransAct bug (#132)
Browse files Browse the repository at this point in the history
- Set polars <= 1.0.0
- Remove group_id from feature_map.json
  • Loading branch information
xpai committed Dec 17, 2024
1 parent 9d89a67 commit 6e3c0ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions fuxictr/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def load(self, json_file, params):
self.labels = feature_map.get("labels", [])
self.total_features = feature_map.get("total_features", 0)
self.input_length = feature_map.get("input_length", 0)
self.group_id = feature_map.get("group_id", None)
self.group_id = params.get("group_id", None)
self.default_emb_dim = params.get("embedding_dim", None)
self.features = OrderedDict((k, v) for x in feature_map["features"] for k, v in x.items())
self.num_fields = self.get_num_fields()
Expand Down Expand Up @@ -74,8 +74,6 @@ def save(self, json_file):
feature_map["total_features"] = self.total_features
feature_map["input_length"] = self.input_length
feature_map["labels"] = self.labels
if self.group_id is not None:
feature_map["group_id"] = self.group_id
feature_map["features"] = [{k: v} for k, v in self.features.items()]
with open(json_file, "w") as fd:
json.dump(feature_map, fd, indent=4)
Expand Down
4 changes: 2 additions & 2 deletions model_zoo/TransAct/src/TransAct.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def __init__(self,
else embedding_dim
)
transformer_in_dim = seq_emb_dim + target_emb_dim
seq_out_dim += (first_k_cols + int(concat_max_pool)) * transformer_in_dim
self.transformer_encoders.append(
TransActTransformer(transformer_in_dim,
dim_feedforward=dim_feedforward,
Expand All @@ -134,7 +133,8 @@ def __init__(self,
first_k_cols=first_k_cols,
concat_max_pool=concat_max_pool)
)
dcn_in_dim = feature_map.sum_emb_out_dim() + seq_out_dim - seq_emb_dim
seq_out_dim += (first_k_cols + int(concat_max_pool)) * transformer_in_dim - seq_emb_dim
dcn_in_dim = feature_map.sum_emb_out_dim() + seq_out_dim
self.crossnet = CrossNetV2(dcn_in_dim, dcn_cross_layers)
self.parallel_dnn = MLP_Block(input_dim=dcn_in_dim,
output_dim=None, # output hidden layer
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ numpy
h5py
tqdm
pyarrow
polars
polars<=1.0.0

0 comments on commit 6e3c0ed

Please sign in to comment.