Suppress open_clip 'no pretrained weights' warning for LRSCLIP init
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ LRSCLIP (DGTRS-CLIP ViT-L-14) uses open_clip layout with KPS positional embeddin
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
import warnings
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import coloredlogs
|
import coloredlogs
|
||||||
@@ -222,7 +223,12 @@ class LRSCLIPTextEncoder(nn.Module):
|
|||||||
|
|
||||||
# Build the open_clip model to get correct architecture, then
|
# Build the open_clip model to get correct architecture, then
|
||||||
# replace positional embedding and add KPS residual.
|
# replace positional embedding and add KPS residual.
|
||||||
|
# Suppress "no pretrained weights" warning — we load DGTRS-CLIP weights after.
|
||||||
|
_root = logging.getLogger()
|
||||||
|
_prev_level = _root.level
|
||||||
|
_root.setLevel(logging.ERROR)
|
||||||
clip_model = open_clip.create_model("ViT-L-14", pretrained=None)
|
clip_model = open_clip.create_model("ViT-L-14", pretrained=None)
|
||||||
|
_root.setLevel(_prev_level)
|
||||||
|
|
||||||
# Extract text components.
|
# Extract text components.
|
||||||
self.token_embedding = clip_model.token_embedding
|
self.token_embedding = clip_model.token_embedding
|
||||||
|
|||||||
Reference in New Issue
Block a user