MCPcopy
hub / github.com/microsoft/Cream / use_teacher_image

Method use_teacher_image

TinyCLIP/src/open_clip/model.py:947–960  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

945 return self.teacher[0]
946
947 def use_teacher_image(self):
948 def teacher_image_encoder_fn(image, normalized=False):
949 teacher = self.get_teacher()
950 with torch.no_grad():
951 return teacher.encode_image(image, normalized=normalized)
952
953 self._image_encoder = FNBlock(teacher_image_encoder_fn)
954
955 class EmptyVisual(nn.Module):
956 def __init__(self):
957 super().__init__()
958 self.layers = 0
959 self._image_encoder.visual = EmptyVisual()
960 self._without_ddp[0] = self._image_encoder
961
962 def use_teacher_text(self):
963 def teacher_text_encoder_fn(text, normalized=False):

Callers 1

load_state_dictMethod · 0.95

Calls 2

FNBlockClass · 0.85
EmptyVisualClass · 0.85

Tested by

no test coverage detected