MCPcopy Index your code
hub / github.com/PaddlePaddle/FastDeploy / __init__

Method __init__

fastdeploy/model_executor/layers/pooler.py:199–212  ·  view source on GitHub ↗
(self, *, static_num_labels: bool = True)

Source from the content-addressed store, hash-verified

197class PoolerClassify(PoolerActivation):
198
199 def __init__(self, *, static_num_labels: bool = True) -> None:
200 super().__init__()
201
202 if static_num_labels:
203 fd_config = FDConfig()
204 self.num_labels = getattr(fd_config.model_config, "num_labels", 0)
205 if self.num_labels == 0:
206 logger.warning(
207 "num_labels should be > 0 for classification"
208 "models, falling back to softmax. "
209 "Please check if the configuration is correct."
210 )
211 else:
212 self.num_labels = None
213
214 def forward_chunk(self, pooled_data: paddle.Tensor) -> paddle.Tensor:
215 num_labels = self.num_labels if self.num_labels is not None else pooled_data.shape[-1]

Callers

nothing calls this directly

Calls 2

FDConfigClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected