Use create_model directly

This commit is contained in:
uservar 2022-11-26 14:16:46 +00:00 committed by GitHub
parent 47b6b607fd
commit 69ba27b4ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,9 +144,8 @@ class FrozenOpenCLIPEmbedder(AbstractEncoder):
freeze=True, layer="last"): freeze=True, layer="last"):
super().__init__() super().__init__()
assert layer in self.LAYERS assert layer in self.LAYERS
model, _, _ = open_clip.create_model_and_transforms(arch, device=torch.device('cpu'), pretrained=version) self.model = open_clip.create_model(arch, device=torch.device('cpu'), pretrained=version)
del model.visual del self.model.visual
self.model = model
self.device = device self.device = device
self.max_length = max_length self.max_length = max_length