[Bugfix] Fix hidden_size for multimodal classification model (#24501)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
@@ -761,3 +761,10 @@ def fast_topk(values: torch.Tensor, topk: int,
|
||||
else:
|
||||
# Use topk for efficiency with larger k values
|
||||
return torch.topk(values, topk, dim=dim)
|
||||
|
||||
|
||||
def get_model_hidden_size(hf_config: PretrainedConfig) -> int:
|
||||
if hasattr(hf_config, "hidden_size"):
|
||||
return hf_config.hidden_size
|
||||
text_config = hf_config.get_text_config()
|
||||
return text_config.hidden_size
|
||||
|
||||
Reference in New Issue
Block a user