Conversation
czffzc
commented
Aug 8, 2025
- support rank_bakcbone and slight support multi_task_backbone
| feature_names: "price" | ||
| group_type: DEEP | ||
| } | ||
| dssm { |
There was a problem hiding this comment.
clean up all non-modular config & rename component to modular
tzrec/models/modular_match.py
Outdated
| ) -> None: | ||
| super().__init__(model_config, features, labels, sample_weights, **kwargs) | ||
|
|
||
| # 获取match_backbone配置 |
There was a problem hiding this comment.
use english comments
tzrec/models/modular_match.py
Outdated
| self._temperature = model_params.temperature | ||
|
|
||
| # 也可以从kwargs中获取参数(运行时传入) | ||
| self._output_dim = kwargs.get("output_dim", self._output_dim) |
There was a problem hiding this comment.
should not use kwargs
| self._match_backbone_config = self._base_model_config.match_backbone | ||
|
|
||
| # 从model_params获取基本参数,设置默认值 | ||
| model_params = getattr(self._match_backbone_config, "model_params", None) |
There was a problem hiding this comment.
In the ModularMatch proto, you can now directly define parameters such as output_dim and similarity_type without the need to reference the ModelParams proto. This streamlines the configuration process, ensuring that all relevant parameters are conveniently specified within the ModularMatch proto itself.
| self._match_backbone_config = self._base_model_config.match_backbone | ||
|
|
||
| # 从model_params获取基本参数,设置默认值 | ||
| model_params = getattr(self._match_backbone_config, "model_params", None) |
There was a problem hiding this comment.
When retrieving parameters from the protobuf configuration, avoid using getattr. Instead, access parameters directly using config.param. This approach enhances code clarity and reduces the risk of errors.
| return field_type == FieldDescriptor.TYPE_MESSAGE | ||
|
|
||
|
|
||
| class Parameter(object): |
There was a problem hiding this comment.
Where do we use Parameter?
tzrec/utils/dimension_inference.py
Outdated
| ) | ||
| return input_dim | ||
|
|
||
| elif layer_type == "DINEncoder": |
There was a problem hiding this comment.
What is the difference between DIN and DINEncoder?
tzrec/utils/dimension_inference.py
Outdated
| ) | ||
| return input_dim | ||
|
|
||
| elif layer_type in [ |
There was a problem hiding this comment.
Hard-code all layers?
tzrec/utils/lambda_inference_test.py
Outdated
|
|
||
| # infer output dimension | ||
| output_dim = lambda_wrapper.infer_output_dim(input_dim) | ||
|
|
There was a problem hiding this comment.
do not print, use assert
| sig = inspect.signature(layer_cls.__init__) | ||
| kwargs = {} | ||
| elif param_type == "st_params": | ||
| params = Parameter(layer_conf.st_params, True) |
There was a problem hiding this comment.
Parameter may not be needed, directly use config_to_kwargs?