gatilin's picture
Publish pinned visual components with exact source payloads and native numerical validation
b9a3411 verified
Raw History Blame Contribute Delete
680 Bytes
"""Construct the exact CLIP-B/16 visual architecture without downloading pretrained weights.
The complete trained CLIP visual state is already in the TokenFlow release.
All layers are the unmodified official TokenFlow CLIP implementation.
"""
from types import SimpleNamespace
from .model import VisionTransformer
def load_clip_vision(name, download_root=None):
if name != 'ViT-B/16':
raise ValueError('This standalone release only supports CLIP-B/16.')
model = VisionTransformer(input_resolution=224, patch_size=16, width=768, layers=12, heads=12, output_dim=512)
del model.proj
return model
clip = SimpleNamespace(load_clip_vision=load_clip_vision)