Download native/clip/__init__.py from gatilin/tokenflow_clipb_32k_visual_codec: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/gatilin/tokenflow_clipb_32k_visual_codec/resolve/main/native/clip/__init__.py
- Command line
-
hf download hf://gatilin/tokenflow_clipb_32k_visual_codec/native/clip/__init__.py
-
curl -L -o __init__.py https://huggingface.co/gatilin/tokenflow_clipb_32k_visual_codec/resolve/main/native/clip/__init__.py
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) | |