MCPcopy Create free account
hub / github.com/NVlabs/RADIO / __init__

Method __init__

examples/common/model_loader.py:69–81  ·  view source on GitHub ↗
(self, clip_model: nn.Module, tokenizer, adaptor_name: str, clip_mode: bool = False)

Source from the content-addressed store, hash-verified

67
68class CLIPWrapper(nn.Module):
69 def __init__(self, clip_model: nn.Module, tokenizer, adaptor_name: str, clip_mode: bool = False):
70 super().__init__()
71 self.inner = clip_model
72 if hasattr(clip_model, 'visual'):
73 clip_model.visual.output_tokens = True
74 self.tokenizer = tokenizer
75 self.adaptor_name = adaptor_name
76
77 if not clip_mode and hasattr(clip_model, 'visual') and hasattr(clip_model.visual, 'proj'):
78 visual = clip_model.visual
79 proj = visual.proj
80 I = torch.eye(proj.shape[0], dtype=proj.dtype, device=proj.device)
81 visual.proj = nn.Parameter(I)
82
83 @property
84 def patch_size(self):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected