Skip to content

Commit e0079c9

Browse files
authored
Update eva.py (#2058)
* Update eva.py When argument class token = False, self.cls_token = None. Prevents error from attempting trunc_normal_ on None: AttributeError: 'NoneType' object has no attribute 'uniform_' * Update eva.py fix
1 parent 7da34a9 commit e0079c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

timm/models/eva.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ def __init__(
479479
self.apply(self._init_weights)
480480
if self.pos_embed is not None:
481481
trunc_normal_(self.pos_embed, std=.02)
482-
trunc_normal_(self.cls_token, std=.02)
482+
if self.cls_token is not None:
483+
trunc_normal_(self.cls_token, std=.02)
483484

484485
self.fix_init_weight()
485486
if isinstance(self.head, nn.Linear):

0 commit comments

Comments
 (0)