MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / Eva2Encoder

Class Eva2Encoder

SwissArmyTransformer/examples/eva2clip/transform_param.py:8–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6from eva2_clip import CustomCLIP
7
8class Eva2Encoder(nn.Module):
9 def __init__(self, image_size=224, ckpt_path=''):
10 super(Eva2Encoder, self).__init__()
11 self.config = get_model_config('EVA02-CLIP-bigE-14')
12 self.config['vision_cfg']['image_size'] = image_size
13 model = CustomCLIP(**self.config)
14 load_checkpoint(model, ckpt_path)
15 self.model = model.visual
16
17 def forward(self, **kwargs):
18 encode = self.model(kwargs['image'], return_all_features=True)[:, 1:, :]
19 return encode
20
21model = Eva2Encoder(image_size=224, ckpt_path='EVA02_CLIP_E_psz14_s4B.pt').bfloat16().cuda()
22

Callers 1

transform_param.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected