Remove CLIP related code

This commit is contained in:
aszc-dev
2023-11-17 22:55:13 +01:00
committed by aszc
parent 45be6761d1
commit 1930be5c98
-22
View File
@@ -1,22 +0,0 @@
import numpy as np
import torch
from comfy.sd import CLIP
from comfy.sd1_clip import SDClipModel
class CoreMLCLIP(CLIP):
pass
class SDClipModelCoreML(SDClipModel):
def __init__(self, **kwargs):
self.model = kwargs.pop("coreml_model")
super().__init__(**kwargs)
def encode_token_weights(self, token_weight_pairs):
tokens = np.array(token_weight_pairs["l"]).astype(np.float16)[:, :, 0]
encoded = self.model(input_ids=tokens)
cond = torch.from_numpy(encoded["last_hidden_state"])
pooled = torch.from_numpy(encoded["pooled_outputs"])
return cond, pooled