Hi Im facing this no module found error on clip though I have installed it.
code:
import clip
ModuleNotFoundError Traceback (most recent call last)
Cell In[5], line 1
----> 1 import clip
code:
import torch
from models.clipseg import CLIPDensePredT
Load the model
model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64)
model.load_state_dict(torch.load('weights/rd64-uni.pth', map_location=torch.device('cpu')), strict=False)
Switch to evaluation mode
model.eval()
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 5
2 from models.clipseg import CLIPDensePredT
4 # Load the model
----> 5 model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64)
6 model.load_state_dict(torch.load('weights/rd64-uni.pth', map_location=torch.device('cpu')), strict=False)
8 # Switch to evaluation mode
File D:\Documents\clipseg\clipseg\models\clipseg.py:276, in CLIPDensePredT.init(self, version, extract_layers, cond_layer, reduce_dim, n_heads, prompt, extra_blocks, reduce_cond, fix_shift, learn_trans_conv_only, limit_to_clip_only, upsample, add_calibration, rev_activations, trans_conv, n_tokens, complex_trans_conv)
271 def init(self, version='ViT-B/32', extract_layers=(3, 6, 9), cond_layer=0, reduce_dim=128, n_heads=4, prompt='fixed',
272 extra_blocks=0, reduce_cond=None, fix_shift=False,
273 learn_trans_conv_only=False, limit_to_clip_only=False, upsample=False,
274 add_calibration=False, rev_activations=False, trans_conv=None, n_tokens=None, complex_trans_conv=False):
--> 276 super().init(version, reduce_cond, reduce_dim, prompt, n_tokens)
277 # device = 'cpu'
279 self.extract_layers = extract_layers
File D:\Documents\clipseg\clipseg\models\clipseg.py:83, in CLIPDenseBase.init(self, version, reduce_cond, reduce_dim, prompt, n_tokens)
80 def init(self, version, reduce_cond, reduce_dim, prompt, n_tokens):
81 super().init()
---> 83 import clip
85 # prec = torch.FloatTensor
86 self.clip_model, _ = clip.load(version, device='cpu', jit=False)
ModuleNotFoundError: No module named 'clip'
Can someone help me resolve. Thank you in advance
Hi Im facing this no module found error on clip though I have installed it.
code:
import clip
ModuleNotFoundError Traceback (most recent call last)
Cell In[5], line 1
----> 1 import clip
code:
import torch
from models.clipseg import CLIPDensePredT
Load the model
model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64)
model.load_state_dict(torch.load('weights/rd64-uni.pth', map_location=torch.device('cpu')), strict=False)
Switch to evaluation mode
model.eval()
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 5
2 from models.clipseg import CLIPDensePredT
4 # Load the model
----> 5 model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64)
6 model.load_state_dict(torch.load('weights/rd64-uni.pth', map_location=torch.device('cpu')), strict=False)
8 # Switch to evaluation mode
File D:\Documents\clipseg\clipseg\models\clipseg.py:276, in CLIPDensePredT.init(self, version, extract_layers, cond_layer, reduce_dim, n_heads, prompt, extra_blocks, reduce_cond, fix_shift, learn_trans_conv_only, limit_to_clip_only, upsample, add_calibration, rev_activations, trans_conv, n_tokens, complex_trans_conv)
271 def init(self, version='ViT-B/32', extract_layers=(3, 6, 9), cond_layer=0, reduce_dim=128, n_heads=4, prompt='fixed',
272 extra_blocks=0, reduce_cond=None, fix_shift=False,
273 learn_trans_conv_only=False, limit_to_clip_only=False, upsample=False,
274 add_calibration=False, rev_activations=False, trans_conv=None, n_tokens=None, complex_trans_conv=False):
--> 276 super().init(version, reduce_cond, reduce_dim, prompt, n_tokens)
277 # device = 'cpu'
279 self.extract_layers = extract_layers
File D:\Documents\clipseg\clipseg\models\clipseg.py:83, in CLIPDenseBase.init(self, version, reduce_cond, reduce_dim, prompt, n_tokens)
80 def init(self, version, reduce_cond, reduce_dim, prompt, n_tokens):
81 super().init()
---> 83 import clip
85 # prec = torch.FloatTensor
86 self.clip_model, _ = clip.load(version, device='cpu', jit=False)
ModuleNotFoundError: No module named 'clip'
Can someone help me resolve. Thank you in advance