-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Hi guys!
Thanks for making your research accessible to the public & congrats on your CVPRW-2024 paper 🎉
Is this the boilerplate required to plugin SynthCLIP in clip-bench as mentioned in #5 or #2 ?
cp Training/models.py <clip-benchmark-dir/clip_benchmark/models/synthclip.py>
Append this function onto that module
def load_synthclip(pretrained: str = "./checkpoints/synthclip-30m/checkpoint_best.pt",
device="cpu", **kwargs):
model = CLIP_VITB16()
# Taken from
# https://github.com/hammoudhasan/SynthCLIP/blob/02ef69764d8dc921650bcac4a98bd0f477790787/Training/main.py#L240
normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
)
transform = transforms.Compose(
[
transforms.Resize(224),
transforms.CenterCrop(224),
transforms.ToTensor(),
# dunno why I need that but whatever XD. EOM - Victor
lambda x: x.repeat(3, 1, 1) if x.shape[0] == 1 else x, # force RGB
normalize,
]
)
model = model.to(device)
tokenizer = open_clip.get_tokenizer("ViT-B-16")
return model, transform, tokenizer
then register it as mentioned here
Thanks in advance!
escorciavescorciavescorciav
Metadata
Metadata
Assignees
Labels
No labels