Skip to content

Commit

Permalink
Another small fix for original mambaout models, no classifier nn.Line…
Browse files Browse the repository at this point in the history
…ar when num_classe=0 on init
  • Loading branch information
rwightman committed Oct 16, 2024
1 parent fad4538 commit 89dffc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion timm/models/mambaout.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(
self.num_features = in_features
self.pre_logits = nn.Identity()

self.fc = nn.Linear(hidden_size, num_classes, bias=bias)
self.fc = nn.Linear(hidden_size, num_classes, bias=bias) if num_classes > 0 else nn.Identity()
self.head_dropout = nn.Dropout(drop_rate)

def reset(self, num_classes: int, pool_type: Optional[str] = None, reset_other: bool = False):
Expand Down

0 comments on commit 89dffc5

Please sign in to comment.