Mercurial > repos > goeckslab > image_learner
annotate MetaFormer/metaformer_models.py @ 11:c5150cceab47 draft default tip
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
author | goeckslab |
---|---|
date | Sat, 18 Oct 2025 03:17:09 +0000 |
parents | |
children |
rev | line source |
---|---|
11
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1 """ |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
2 MetaFormer baselines including IdentityFormer, RandFormer, PoolFormerV2, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
3 ConvFormer and CAFormer. |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
4 Standalone implementation for Galaxy Image Learner tool (no timm dependency). |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
5 """ |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
6 import logging |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
7 from functools import partial |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
8 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
9 import torch |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
10 import torch.nn as nn |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
11 import torch.nn.functional as F |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
12 from torch.nn.init import trunc_normal_ # use torch's built-in truncated normal |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
13 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
14 logger = logging.getLogger(__name__) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
15 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
16 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
17 def to_2tuple(v): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
18 if isinstance(v, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
19 return tuple(v) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
20 return (v, v) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
21 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
22 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
23 class DropPath(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
24 def __init__(self, drop_prob: float = 0.0): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
25 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
26 self.drop_prob = float(drop_prob) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
27 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
28 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
29 if self.drop_prob == 0.0 or not self.training: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
30 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
31 keep_prob = 1.0 - self.drop_prob |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
32 shape = (x.shape[0],) + (1,) * (x.ndim - 1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
33 random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x.device) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
34 random_tensor.floor_() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
35 return x.div(keep_prob) * random_tensor |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
36 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
37 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
38 # ImageNet normalization constants |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
39 IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
40 IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
41 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
42 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
43 def register_model(fn): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
44 # no-op decorator to mirror timm API without dependency |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
45 return fn |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
46 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
47 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
48 def _cfg(url: str = '', **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
49 return { |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
50 'url': url, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
51 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': None, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
52 'crop_pct': 1.0, 'interpolation': 'bicubic', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
53 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'classifier': 'head', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
54 **kwargs |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
55 } |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
56 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
57 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
58 default_cfgs = { |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
59 'identityformer_s12': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
60 url='https://huggingface.co/sail/dl/resolve/main/identityformer/identityformer_s12.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
61 'identityformer_s24': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
62 url='https://huggingface.co/sail/dl/resolve/main/identityformer/identityformer_s24.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
63 'identityformer_s36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
64 url='https://huggingface.co/sail/dl/resolve/main/identityformer/identityformer_s36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
65 'identityformer_m36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
66 url='https://huggingface.co/sail/dl/resolve/main/identityformer/identityformer_m36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
67 'identityformer_m48': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
68 url='https://huggingface.co/sail/dl/resolve/main/identityformer/identityformer_m48.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
69 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
70 'randformer_s12': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
71 url='https://huggingface.co/sail/dl/resolve/main/randformer/randformer_s12.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
72 'randformer_s24': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
73 url='https://huggingface.co/sail/dl/resolve/main/randformer/randformer_s24.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
74 'randformer_s36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
75 url='https://huggingface.co/sail/dl/resolve/main/randformer/randformer_s36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
76 'randformer_m36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
77 url='https://huggingface.co/sail/dl/resolve/main/randformer/randformer_m36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
78 'randformer_m48': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
79 url='https://huggingface.co/sail/dl/resolve/main/randformer/randformer_m48.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
80 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
81 'poolformerv2_s12': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
82 url='https://huggingface.co/sail/dl/resolve/main/poolformerv2/poolformerv2_s12.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
83 'poolformerv2_s24': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
84 url='https://huggingface.co/sail/dl/resolve/main/poolformerv2/poolformerv2_s24.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
85 'poolformerv2_s36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
86 url='https://huggingface.co/sail/dl/resolve/main/poolformerv2/poolformerv2_s36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
87 'poolformerv2_m36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
88 url='https://huggingface.co/sail/dl/resolve/main/poolformerv2/poolformerv2_m36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
89 'poolformerv2_m48': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
90 url='https://huggingface.co/sail/dl/resolve/main/poolformerv2/poolformerv2_m48.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
91 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
92 'convformer_s18': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
93 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s18.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
94 'convformer_s18_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
95 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s18_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
96 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
97 'convformer_s18_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
98 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s18_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
99 'convformer_s18_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
100 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s18_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
101 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
102 'convformer_s18_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
103 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s18_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
104 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
105 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
106 'convformer_s36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
107 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
108 'convformer_s36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
109 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
110 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
111 'convformer_s36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
112 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
113 'convformer_s36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
114 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
115 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
116 'convformer_s36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
117 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_s36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
118 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
119 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
120 'convformer_m36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
121 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_m36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
122 'convformer_m36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
123 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_m36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
124 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
125 'convformer_m36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
126 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_m36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
127 'convformer_m36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
128 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_m36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
129 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
130 'convformer_m36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
131 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_m36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
132 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
133 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
134 'convformer_b36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
135 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_b36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
136 'convformer_b36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
137 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_b36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
138 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
139 'convformer_b36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
140 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_b36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
141 'convformer_b36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
142 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_b36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
143 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
144 'convformer_b36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
145 url='https://huggingface.co/sail/dl/resolve/main/convformer/convformer_b36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
146 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
147 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
148 'caformer_s18': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
149 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s18.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
150 'caformer_s18_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
151 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s18_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
152 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
153 'caformer_s18_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
154 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s18_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
155 'caformer_s18_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
156 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s18_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
157 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
158 'caformer_s18_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
159 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s18_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
160 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
161 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
162 'caformer_s36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
163 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
164 'caformer_s36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
165 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
166 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
167 'caformer_s36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
168 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
169 'caformer_s36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
170 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
171 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
172 'caformer_s36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
173 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_s36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
174 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
175 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
176 'caformer_m36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
177 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_m36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
178 'caformer_m36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
179 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_m36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
180 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
181 'caformer_m36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
182 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_m36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
183 'caformer_m36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
184 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_m36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
185 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
186 'caformer_m36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
187 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_m36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
188 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
189 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
190 'caformer_b36': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
191 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_b36.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
192 'caformer_b36_384': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
193 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_b36_384.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
194 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
195 'caformer_b36_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
196 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_b36_in21ft1k.pth'), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
197 'caformer_b36_384_in21ft1k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
198 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_b36_384_in21ft1k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
199 input_size=(3, 384, 384)), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
200 'caformer_b36_in21k': _cfg( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
201 url='https://huggingface.co/sail/dl/resolve/main/caformer/caformer_b36_in21k.pth', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
202 num_classes=21841), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
203 } |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
204 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
205 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
206 class Downsampling(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
207 """Downsampling implemented by a layer of convolution.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
208 def __init__(self, in_channels, out_channels, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
209 kernel_size, stride=1, padding=0, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
210 pre_norm=None, post_norm=None, pre_permute=False): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
211 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
212 self.pre_norm = pre_norm(in_channels) if pre_norm else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
213 self.pre_permute = pre_permute |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
214 self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
215 stride=stride, padding=padding) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
216 self.post_norm = post_norm(out_channels) if post_norm else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
217 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
218 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
219 x = self.pre_norm(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
220 if self.pre_permute: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
221 x = x.permute(0, 3, 1, 2) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
222 x = self.conv(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
223 x = x.permute(0, 2, 3, 1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
224 x = self.post_norm(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
225 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
226 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
227 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
228 class Scale(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
229 """Scale vector by element multiplications.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
230 def __init__(self, dim, init_value=1.0, trainable=True): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
231 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
232 self.scale = nn.Parameter(init_value * torch.ones(dim), requires_grad=trainable) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
233 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
234 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
235 return x * self.scale |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
236 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
237 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
238 class SquaredReLU(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
239 """Squared ReLU: https://arxiv.org/abs/2109.08668""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
240 def __init__(self, inplace=False): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
241 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
242 self.relu = nn.ReLU(inplace=inplace) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
243 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
244 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
245 return torch.square(self.relu(x)) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
246 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
247 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
248 class StarReLU(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
249 """StarReLU: s * relu(x) ** 2 + b""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
250 def __init__(self, scale_value=1.0, bias_value=0.0, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
251 scale_learnable=True, bias_learnable=True, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
252 mode=None, inplace=False): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
253 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
254 self.inplace = inplace |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
255 self.relu = nn.ReLU(inplace=inplace) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
256 self.scale = nn.Parameter(scale_value * torch.ones(1), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
257 requires_grad=scale_learnable) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
258 self.bias = nn.Parameter(bias_value * torch.ones(1), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
259 requires_grad=bias_learnable) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
260 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
261 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
262 return self.scale * self.relu(x) ** 2 + self.bias |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
263 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
264 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
265 class Attention(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
266 """Vanilla self-attention from Transformer.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
267 def __init__(self, dim, head_dim=32, num_heads=None, qkv_bias=False, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
268 attn_drop=0., proj_drop=0., proj_bias=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
269 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
270 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
271 self.head_dim = head_dim |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
272 self.scale = head_dim ** -0.5 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
273 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
274 self.num_heads = num_heads if num_heads else dim // head_dim |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
275 if self.num_heads == 0: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
276 self.num_heads = 1 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
277 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
278 self.attention_dim = self.num_heads * self.head_dim |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
279 self.qkv = nn.Linear(dim, self.attention_dim * 3, bias=qkv_bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
280 self.attn_drop = nn.Dropout(attn_drop) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
281 self.proj = nn.Linear(self.attention_dim, dim, bias=proj_bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
282 self.proj_drop = nn.Dropout(proj_drop) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
283 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
284 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
285 B, H, W, C = x.shape |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
286 N = H * W |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
287 qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, self.head_dim).permute(2, 0, 3, 1, 4) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
288 q, k, v = qkv.unbind(0) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
289 attn = (q @ k.transpose(-2, -1)) * self.scale |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
290 attn = attn.softmax(dim=-1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
291 attn = self.attn_drop(attn) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
292 x = (attn @ v).transpose(1, 2).reshape(B, H, W, self.attention_dim) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
293 x = self.proj(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
294 x = self.proj_drop(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
295 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
296 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
297 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
298 class RandomMixing(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
299 def __init__(self, num_tokens=196, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
300 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
301 self.num_tokens = num_tokens |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
302 base_matrix = torch.softmax(torch.rand(num_tokens, num_tokens), dim=-1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
303 self.register_buffer("random_matrix", base_matrix, persistent=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
304 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
305 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
306 B, H, W, C = x.shape |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
307 actual_tokens = H * W |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
308 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
309 if actual_tokens == self.random_matrix.shape[0]: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
310 mixing = self.random_matrix |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
311 else: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
312 base = self.random_matrix |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
313 if base.device != x.device: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
314 base = base.to(x.device) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
315 resized = F.interpolate( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
316 base.unsqueeze(0).unsqueeze(0), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
317 size=(actual_tokens, actual_tokens), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
318 mode='bilinear', |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
319 align_corners=False, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
320 ).squeeze(0).squeeze(0) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
321 mixing = torch.softmax(resized, dim=-1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
322 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
323 x = x.reshape(B, actual_tokens, C) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
324 x = torch.einsum('mn, bnc -> bmc', mixing, x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
325 x = x.reshape(B, H, W, C) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
326 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
327 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
328 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
329 class LayerNormGeneral(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
330 """General LayerNorm for different situations.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
331 def __init__(self, affine_shape=None, normalized_dim=(-1,), scale=True, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
332 bias=True, eps=1e-5): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
333 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
334 self.normalized_dim = normalized_dim |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
335 self.use_scale = scale |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
336 self.use_bias = bias |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
337 self.weight = nn.Parameter(torch.ones(affine_shape)) if scale else None |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
338 self.bias = nn.Parameter(torch.zeros(affine_shape)) if bias else None |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
339 self.eps = eps |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
340 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
341 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
342 c = x - x.mean(self.normalized_dim, keepdim=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
343 s = c.pow(2).mean(self.normalized_dim, keepdim=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
344 x = c / torch.sqrt(s + self.eps) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
345 if self.use_scale: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
346 x = x * self.weight |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
347 if self.use_bias: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
348 x = x + self.bias |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
349 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
350 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
351 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
352 class LayerNormWithoutBias(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
353 """Equal to partial(LayerNormGeneral, bias=False) but faster.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
354 def __init__(self, normalized_shape, eps=1e-5, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
355 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
356 self.eps = eps |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
357 self.bias = None |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
358 if isinstance(normalized_shape, int): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
359 normalized_shape = (normalized_shape,) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
360 self.weight = nn.Parameter(torch.ones(normalized_shape)) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
361 self.normalized_shape = normalized_shape |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
362 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
363 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
364 return F.layer_norm(x, self.normalized_shape, weight=self.weight, bias=self.bias, eps=self.eps) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
365 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
366 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
367 class SepConv(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
368 """Inverted separable convolution from MobileNetV2.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
369 def __init__(self, dim, expansion_ratio=2, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
370 act1_layer=StarReLU, act2_layer=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
371 bias=False, kernel_size=7, padding=3, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
372 **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
373 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
374 med_channels = int(expansion_ratio * dim) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
375 self.pwconv1 = nn.Linear(dim, med_channels, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
376 self.act1 = act1_layer() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
377 self.dwconv = nn.Conv2d( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
378 med_channels, med_channels, kernel_size=kernel_size, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
379 padding=padding, groups=med_channels, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
380 self.act2 = act2_layer() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
381 self.pwconv2 = nn.Linear(med_channels, dim, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
382 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
383 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
384 x = self.pwconv1(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
385 x = self.act1(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
386 x = x.permute(0, 3, 1, 2) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
387 x = self.dwconv(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
388 x = x.permute(0, 2, 3, 1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
389 x = self.act2(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
390 x = self.pwconv2(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
391 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
392 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
393 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
394 class Pooling(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
395 """Pooling for PoolFormer.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
396 def __init__(self, pool_size=3, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
397 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
398 self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size // 2, count_include_pad=False) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
399 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
400 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
401 y = x.permute(0, 3, 1, 2) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
402 y = self.pool(y) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
403 y = y.permute(0, 2, 3, 1) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
404 return y - x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
405 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
406 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
407 class Mlp(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
408 """ MLP used in MetaFormer models.""" |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
409 def __init__(self, dim, mlp_ratio=4, out_features=None, act_layer=StarReLU, drop=0., bias=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
410 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
411 in_features = dim |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
412 out_features = out_features or in_features |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
413 hidden_features = int(mlp_ratio * in_features) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
414 drop_probs = to_2tuple(drop) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
415 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
416 self.fc1 = nn.Linear(in_features, hidden_features, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
417 self.act = act_layer() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
418 self.drop1 = nn.Dropout(drop_probs[0]) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
419 self.fc2 = nn.Linear(hidden_features, out_features, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
420 self.drop2 = nn.Dropout(drop_probs[1]) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
421 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
422 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
423 x = self.fc1(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
424 x = self.act(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
425 x = self.drop1(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
426 x = self.fc2(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
427 x = self.drop2(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
428 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
429 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
430 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
431 class MlpHead(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
432 def __init__(self, dim, num_classes=1000, mlp_ratio=4, act_layer=SquaredReLU, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
433 norm_layer=nn.LayerNorm, head_dropout=0., bias=True): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
434 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
435 hidden_features = int(mlp_ratio * dim) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
436 self.fc1 = nn.Linear(dim, hidden_features, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
437 self.act = act_layer() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
438 self.norm = norm_layer(hidden_features) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
439 self.fc2 = nn.Linear(hidden_features, num_classes, bias=bias) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
440 self.head_dropout = nn.Dropout(head_dropout) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
441 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
442 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
443 x = self.fc1(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
444 x = self.act(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
445 x = self.norm(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
446 x = self.head_dropout(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
447 x = self.fc2(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
448 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
449 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
450 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
451 class MetaFormerBlock(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
452 def __init__(self, dim, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
453 token_mixer=nn.Identity, mlp=Mlp, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
454 norm_layer=nn.LayerNorm, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
455 drop=0., drop_path=0., |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
456 layer_scale_init_value=None, res_scale_init_value=None): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
457 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
458 self.norm1 = norm_layer(dim) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
459 self.token_mixer = token_mixer(dim=dim, drop=drop) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
460 self.drop_path1 = DropPath(drop_path) if drop_path > 0. else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
461 self.layer_scale1 = Scale(dim=dim, init_value=layer_scale_init_value) if layer_scale_init_value else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
462 self.res_scale1 = Scale(dim=dim, init_value=res_scale_init_value) if res_scale_init_value else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
463 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
464 self.norm2 = norm_layer(dim) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
465 self.mlp = mlp(dim=dim, drop=drop) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
466 self.drop_path2 = DropPath(drop_path) if drop_path > 0. else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
467 self.layer_scale2 = Scale(dim=dim, init_value=layer_scale_init_value) if layer_scale_init_value else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
468 self.res_scale2 = Scale(dim=dim, init_value=res_scale_init_value) if res_scale_init_value else nn.Identity() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
469 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
470 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
471 x = self.res_scale1(x) + self.layer_scale1(self.drop_path1(self.token_mixer(self.norm1(x)))) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
472 x = self.res_scale2(x) + self.layer_scale2(self.drop_path2(self.mlp(self.norm2(x)))) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
473 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
474 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
475 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
476 DOWNSAMPLE_LAYERS_FOUR_STAGES = [partial(Downsampling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
477 kernel_size=7, stride=4, padding=2, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
478 post_norm=partial(LayerNormGeneral, bias=False, eps=1e-6) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
479 )] + \ |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
480 [partial(Downsampling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
481 kernel_size=3, stride=2, padding=1, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
482 pre_norm=partial(LayerNormGeneral, bias=False, eps=1e-6), pre_permute=True |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
483 )] * 3 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
484 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
485 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
486 class MetaFormer(nn.Module): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
487 def __init__(self, in_chans=3, num_classes=1000, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
488 depths=[2, 2, 6, 2], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
489 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
490 downsample_layers=DOWNSAMPLE_LAYERS_FOUR_STAGES, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
491 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
492 mlps=Mlp, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
493 norm_layers=partial(LayerNormWithoutBias, eps=1e-6), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
494 drop_path_rate=0., |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
495 head_dropout=0.0, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
496 layer_scale_init_values=None, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
497 res_scale_init_values=[None, None, 1.0, 1.0], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
498 output_norm=partial(nn.LayerNorm, eps=1e-6), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
499 head_fn=nn.Linear, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
500 **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
501 super().__init__() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
502 self.num_classes = num_classes |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
503 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
504 if not isinstance(depths, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
505 depths = [depths] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
506 if not isinstance(dims, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
507 dims = [dims] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
508 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
509 num_stage = len(depths) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
510 self.num_stage = num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
511 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
512 if not isinstance(downsample_layers, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
513 downsample_layers = [downsample_layers] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
514 down_dims = [in_chans] + dims |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
515 self.downsample_layers = nn.ModuleList( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
516 [downsample_layers[i](down_dims[i], down_dims[i + 1]) for i in range(num_stage)] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
517 ) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
518 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
519 if not isinstance(token_mixers, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
520 token_mixers = [token_mixers] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
521 if not isinstance(mlps, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
522 mlps = [mlps] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
523 if not isinstance(norm_layers, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
524 norm_layers = [norm_layers] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
525 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
526 dp_rates = [x.item() for x in torch.linspace(0, drop_path_rate, sum(depths))] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
527 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
528 if not isinstance(layer_scale_init_values, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
529 layer_scale_init_values = [layer_scale_init_values] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
530 if not isinstance(res_scale_init_values, (list, tuple)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
531 res_scale_init_values = [res_scale_init_values] * num_stage |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
532 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
533 self.stages = nn.ModuleList() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
534 cur = 0 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
535 for i in range(num_stage): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
536 stage = nn.Sequential( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
537 *[MetaFormerBlock(dim=dims[i], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
538 token_mixer=token_mixers[i], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
539 mlp=mlps[i], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
540 norm_layer=norm_layers[i], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
541 drop_path=dp_rates[cur + j], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
542 layer_scale_init_value=layer_scale_init_values[i], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
543 res_scale_init_value=res_scale_init_values[i]) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
544 for j in range(depths[i])] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
545 ) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
546 self.stages.append(stage) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
547 cur += depths[i] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
548 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
549 self.norm = output_norm(dims[-1]) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
550 self.head = head_fn(dims[-1], num_classes) if head_dropout <= 0.0 else head_fn(dims[-1], num_classes, head_dropout=head_dropout) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
551 self.apply(self._init_weights) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
552 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
553 def _init_weights(self, m): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
554 if isinstance(m, (nn.Conv2d, nn.Linear)): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
555 trunc_normal_(m.weight, std=.02) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
556 if m.bias is not None: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
557 nn.init.constant_(m.bias, 0) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
558 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
559 @torch.jit.ignore |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
560 def no_weight_decay(self): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
561 return {'norm'} |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
562 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
563 def forward_features(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
564 for i in range(self.num_stage): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
565 x = self.downsample_layers[i](x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
566 x = self.stages[i](x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
567 return self.norm(x.mean([1, 2])) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
568 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
569 def forward(self, x): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
570 x = self.forward_features(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
571 x = self.head(x) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
572 return x |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
573 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
574 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
575 # ---- Model factory functions (subset, extend as needed) ---- |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
576 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
577 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
578 def identityformer_s12(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
579 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
580 depths=[2, 2, 6, 2], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
581 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
582 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
583 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
584 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
585 model.default_cfg = default_cfgs['identityformer_s12'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
586 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
587 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
588 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
589 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
590 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
591 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
592 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
593 def identityformer_s24(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
594 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
595 depths=[4, 4, 12, 4], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
596 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
597 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
598 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
599 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
600 model.default_cfg = default_cfgs['identityformer_s24'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
601 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
602 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
603 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
604 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
605 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
606 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
607 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
608 def identityformer_s36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
609 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
610 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
611 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
612 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
613 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
614 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
615 model.default_cfg = default_cfgs['identityformer_s36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
616 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
617 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
618 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
619 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
620 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
621 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
622 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
623 def identityformer_m36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
624 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
625 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
626 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
627 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
628 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
629 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
630 model.default_cfg = default_cfgs['identityformer_m36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
631 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
632 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
633 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
634 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
635 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
636 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
637 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
638 def identityformer_m48(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
639 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
640 depths=[8, 8, 24, 8], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
641 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
642 token_mixers=nn.Identity, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
643 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
644 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
645 model.default_cfg = default_cfgs['identityformer_m48'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
646 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
647 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
648 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
649 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
650 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
651 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
652 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
653 def randformer_s12(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
654 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
655 depths=[2, 2, 6, 2], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
656 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
657 token_mixers=[nn.Identity, nn.Identity, RandomMixing, partial(RandomMixing, num_tokens=49)], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
658 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
659 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
660 model.default_cfg = default_cfgs['randformer_s12'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
661 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
662 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
663 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
664 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
665 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
666 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
667 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
668 def randformer_s24(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
669 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
670 depths=[4, 4, 12, 4], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
671 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
672 token_mixers=[nn.Identity, nn.Identity, RandomMixing, partial(RandomMixing, num_tokens=49)], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
673 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
674 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
675 model.default_cfg = default_cfgs['randformer_s24'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
676 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
677 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
678 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
679 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
680 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
681 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
682 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
683 def randformer_s36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
684 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
685 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
686 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
687 token_mixers=[nn.Identity, nn.Identity, RandomMixing, partial(RandomMixing, num_tokens=49)], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
688 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
689 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
690 model.default_cfg = default_cfgs['randformer_s36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
691 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
692 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
693 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
694 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
695 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
696 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
697 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
698 def randformer_m36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
699 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
700 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
701 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
702 token_mixers=[nn.Identity, nn.Identity, RandomMixing, partial(RandomMixing, num_tokens=49)], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
703 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
704 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
705 model.default_cfg = default_cfgs['randformer_m36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
706 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
707 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
708 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
709 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
710 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
711 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
712 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
713 def randformer_m48(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
714 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
715 depths=[8, 8, 24, 8], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
716 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
717 token_mixers=[nn.Identity, nn.Identity, RandomMixing, partial(RandomMixing, num_tokens=49)], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
718 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
719 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
720 model.default_cfg = default_cfgs['randformer_m48'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
721 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
722 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
723 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
724 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
725 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
726 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
727 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
728 def poolformerv2_s12(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
729 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
730 depths=[2, 2, 6, 2], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
731 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
732 token_mixers=Pooling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
733 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
734 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
735 model.default_cfg = default_cfgs['poolformerv2_s12'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
736 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
737 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
738 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
739 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
740 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
741 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
742 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
743 def poolformerv2_s24(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
744 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
745 depths=[4, 4, 12, 4], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
746 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
747 token_mixers=Pooling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
748 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
749 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
750 model.default_cfg = default_cfgs['poolformerv2_s24'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
751 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
752 try: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
753 logger.info("Loading pretrained weights for poolformerv2_s24 from: %s", model.default_cfg['url']) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
754 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
755 # Add timeout to prevent hanging in CI environments |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
756 import socket |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
757 original_timeout = socket.getdefaulttimeout() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
758 socket.setdefaulttimeout(60) # 60 second timeout |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
759 try: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
760 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
761 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
762 print("✓ Successfully loaded pretrained weights for poolformerv2_s24") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
763 finally: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
764 socket.setdefaulttimeout(original_timeout) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
765 except Exception as e: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
766 logger.warning("Failed to load pretrained weights for poolformerv2_s24: %s", e) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
767 logger.info("Continuing with randomly initialized weights...") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
768 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
769 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
770 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
771 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
772 def poolformerv2_s36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
773 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
774 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
775 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
776 token_mixers=Pooling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
777 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
778 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
779 model.default_cfg = default_cfgs['poolformerv2_s36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
780 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
781 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
782 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
783 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
784 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
785 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
786 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
787 def poolformerv2_m36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
788 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
789 depths=[6, 6, 18, 6], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
790 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
791 token_mixers=Pooling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
792 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
793 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
794 model.default_cfg = default_cfgs['poolformerv2_m36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
795 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
796 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
797 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
798 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
799 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
800 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
801 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
802 def poolformerv2_m48(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
803 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
804 depths=[8, 8, 24, 8], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
805 dims=[96, 192, 384, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
806 token_mixers=Pooling, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
807 norm_layers=partial(LayerNormGeneral, normalized_dim=(1, 2, 3), eps=1e-6, bias=False), |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
808 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
809 model.default_cfg = default_cfgs['poolformerv2_m48'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
810 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
811 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
812 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
813 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
814 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
815 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
816 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
817 def convformer_s18(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
818 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
819 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
820 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
821 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
822 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
823 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
824 model.default_cfg = default_cfgs['convformer_s18'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
825 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
826 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
827 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
828 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
829 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
830 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
831 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
832 def convformer_s18_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
833 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
834 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
835 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
836 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
837 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
838 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
839 model.default_cfg = default_cfgs['convformer_s18_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
840 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
841 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
842 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
843 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
844 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
845 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
846 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
847 def convformer_s18_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
848 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
849 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
850 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
851 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
852 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
853 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
854 model.default_cfg = default_cfgs['convformer_s18_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
855 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
856 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
857 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
858 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
859 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
860 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
861 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
862 def convformer_s18_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
863 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
864 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
865 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
866 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
867 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
868 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
869 model.default_cfg = default_cfgs['convformer_s18_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
870 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
871 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
872 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
873 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
874 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
875 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
876 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
877 def convformer_s18_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
878 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
879 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
880 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
881 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
882 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
883 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
884 model.default_cfg = default_cfgs['convformer_s18_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
885 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
886 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
887 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
888 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
889 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
890 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
891 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
892 def convformer_s36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
893 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
894 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
895 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
896 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
897 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
898 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
899 model.default_cfg = default_cfgs['convformer_s36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
900 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
901 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
902 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
903 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
904 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
905 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
906 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
907 def convformer_s36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
908 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
909 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
910 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
911 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
912 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
913 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
914 model.default_cfg = default_cfgs['convformer_s36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
915 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
916 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
917 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
918 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
919 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
920 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
921 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
922 def convformer_s36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
923 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
924 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
925 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
926 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
927 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
928 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
929 model.default_cfg = default_cfgs['convformer_s36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
930 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
931 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
932 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
933 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
934 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
935 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
936 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
937 def convformer_s36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
938 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
939 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
940 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
941 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
942 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
943 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
944 model.default_cfg = default_cfgs['convformer_s36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
945 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
946 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
947 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
948 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
949 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
950 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
951 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
952 def convformer_s36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
953 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
954 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
955 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
956 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
957 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
958 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
959 model.default_cfg = default_cfgs['convformer_s36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
960 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
961 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
962 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
963 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
964 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
965 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
966 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
967 def convformer_m36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
968 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
969 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
970 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
971 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
972 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
973 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
974 model.default_cfg = default_cfgs['convformer_m36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
975 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
976 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
977 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
978 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
979 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
980 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
981 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
982 def convformer_m36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
983 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
984 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
985 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
986 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
987 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
988 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
989 model.default_cfg = default_cfgs['convformer_m36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
990 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
991 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
992 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
993 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
994 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
995 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
996 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
997 def convformer_m36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
998 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
999 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1000 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1001 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1002 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1003 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1004 model.default_cfg = default_cfgs['convformer_m36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1005 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1006 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1007 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1008 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1009 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1010 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1011 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1012 def convformer_m36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1013 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1014 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1015 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1016 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1017 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1018 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1019 model.default_cfg = default_cfgs['convformer_m36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1020 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1021 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1022 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1023 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1024 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1025 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1026 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1027 def convformer_m36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1028 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1029 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1030 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1031 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1032 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1033 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1034 model.default_cfg = default_cfgs['convformer_m36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1035 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1036 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1037 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1038 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1039 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1040 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1041 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1042 def convformer_b36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1043 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1044 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1045 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1046 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1047 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1048 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1049 model.default_cfg = default_cfgs['convformer_b36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1050 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1051 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1052 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1053 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1054 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1055 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1056 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1057 def convformer_b36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1058 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1059 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1060 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1061 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1062 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1063 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1064 model.default_cfg = default_cfgs['convformer_b36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1065 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1066 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1067 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1068 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1069 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1070 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1071 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1072 def convformer_b36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1073 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1074 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1075 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1076 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1077 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1078 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1079 model.default_cfg = default_cfgs['convformer_b36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1080 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1081 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1082 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1083 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1084 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1085 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1086 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1087 def convformer_b36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1088 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1089 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1090 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1091 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1092 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1093 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1094 model.default_cfg = default_cfgs['convformer_b36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1095 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1096 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1097 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1098 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1099 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1100 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1101 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1102 def convformer_b36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1103 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1104 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1105 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1106 token_mixers=SepConv, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1107 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1108 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1109 model.default_cfg = default_cfgs['convformer_b36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1110 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1111 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1112 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1113 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1114 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1115 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1116 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1117 def caformer_s18(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1118 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1119 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1120 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1121 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1122 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1123 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1124 model.default_cfg = default_cfgs['caformer_s18'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1125 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1126 try: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1127 print(f"Loading pretrained weights for caformer_s18 from: {model.default_cfg['url']}") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1128 # Add timeout to prevent hanging in CI environments |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1129 import socket |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1130 original_timeout = socket.getdefaulttimeout() |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1131 socket.setdefaulttimeout(60) # 60 second timeout |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1132 try: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1133 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1134 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1135 print("✓ Successfully loaded pretrained weights for caformer_s18") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1136 finally: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1137 socket.setdefaulttimeout(original_timeout) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1138 except Exception as e: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1139 print(f"âš Warning: Failed to load pretrained weights for caformer_s18: {e}") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1140 print("Continuing with randomly initialized weights...") |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1141 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1142 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1143 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1144 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1145 def caformer_s18_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1146 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1147 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1148 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1149 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1150 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1151 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1152 model.default_cfg = default_cfgs['caformer_s18_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1153 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1154 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1155 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1156 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1157 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1158 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1159 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1160 def caformer_s18_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1161 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1162 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1163 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1164 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1165 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1166 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1167 model.default_cfg = default_cfgs['caformer_s18_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1168 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1169 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1170 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1171 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1172 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1173 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1174 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1175 def caformer_s18_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1176 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1177 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1178 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1179 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1180 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1181 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1182 model.default_cfg = default_cfgs['caformer_s18_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1183 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1184 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1185 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1186 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1187 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1188 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1189 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1190 def caformer_s18_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1191 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1192 depths=[3, 3, 9, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1193 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1194 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1195 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1196 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1197 model.default_cfg = default_cfgs['caformer_s18_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1198 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1199 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1200 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1201 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1202 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1203 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1204 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1205 def caformer_s36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1206 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1207 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1208 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1209 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1210 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1211 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1212 model.default_cfg = default_cfgs['caformer_s36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1213 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1214 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1215 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1216 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1217 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1218 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1219 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1220 def caformer_s36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1221 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1222 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1223 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1224 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1225 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1226 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1227 model.default_cfg = default_cfgs['caformer_s36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1228 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1229 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1230 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1231 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1232 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1233 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1234 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1235 def caformer_s36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1236 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1237 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1238 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1239 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1240 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1241 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1242 model.default_cfg = default_cfgs['caformer_s36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1243 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1244 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1245 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1246 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1247 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1248 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1249 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1250 def caformer_s36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1251 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1252 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1253 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1254 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1255 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1256 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1257 model.default_cfg = default_cfgs['caformer_s36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1258 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1259 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1260 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1261 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1262 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1263 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1264 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1265 def caformer_s36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1266 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1267 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1268 dims=[64, 128, 320, 512], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1269 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1270 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1271 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1272 model.default_cfg = default_cfgs['caformer_s36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1273 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1274 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1275 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1276 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1277 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1278 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1279 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1280 def caformer_m36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1281 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1282 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1283 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1284 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1285 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1286 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1287 model.default_cfg = default_cfgs['caformer_m36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1288 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1289 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1290 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1291 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1292 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1293 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1294 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1295 def caformer_m36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1296 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1297 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1298 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1299 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1300 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1301 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1302 model.default_cfg = default_cfgs['caformer_m36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1303 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1304 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1305 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1306 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1307 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1308 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1309 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1310 def caformer_m36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1311 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1312 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1313 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1314 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1315 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1316 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1317 model.default_cfg = default_cfgs['caformer_m36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1318 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1319 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1320 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1321 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1322 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1323 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1324 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1325 def caformer_m36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1326 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1327 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1328 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1329 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1330 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1331 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1332 model.default_cfg = default_cfgs['caformer_m36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1333 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1334 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1335 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1336 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1337 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1338 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1339 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1340 def caformer_m36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1341 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1342 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1343 dims=[96, 192, 384, 576], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1344 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1345 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1346 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1347 model.default_cfg = default_cfgs['caformer_m36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1348 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1349 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1350 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1351 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1352 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1353 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1354 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1355 def caformer_b36(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1356 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1357 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1358 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1359 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1360 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1361 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1362 model.default_cfg = default_cfgs['caformer_b36'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1363 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1364 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1365 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1366 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1367 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1368 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1369 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1370 def caformer_b36_384(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1371 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1372 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1373 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1374 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1375 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1376 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1377 model.default_cfg = default_cfgs['caformer_b36_384'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1378 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1379 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1380 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1381 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1382 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1383 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1384 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1385 def caformer_b36_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1386 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1387 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1388 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1389 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1390 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1391 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1392 model.default_cfg = default_cfgs['caformer_b36_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1393 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1394 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1395 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1396 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1397 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1398 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1399 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1400 def caformer_b36_384_in21ft1k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1401 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1402 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1403 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1404 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1405 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1406 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1407 model.default_cfg = default_cfgs['caformer_b36_384_in21ft1k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1408 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1409 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1410 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1411 return model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1412 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1413 |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1414 @register_model |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1415 def caformer_b36_in21k(pretrained=False, **kwargs): |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1416 model = MetaFormer( |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1417 depths=[3, 12, 18, 3], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1418 dims=[128, 256, 512, 768], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1419 token_mixers=[SepConv, SepConv, Attention, Attention], |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1420 head_fn=MlpHead, |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1421 **kwargs) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1422 model.default_cfg = default_cfgs['caformer_b36_in21k'] |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1423 if pretrained: |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1424 state_dict = torch.hub.load_state_dict_from_url(url=model.default_cfg['url'], map_location="cpu", check_hash=True) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1425 model.load_state_dict(state_dict) |
c5150cceab47
planemo upload for repository https://github.com/goeckslab/gleam.git commit 0fe927b618cd4dfc87af7baaa827034cc6813225
goeckslab
parents:
diff
changeset
|
1426 return model |