Commit 210449b3 authored by AUTOMATIC's avatar AUTOMATIC
Browse files

fix 'RuntimeError: Expected all tensors to be on the same device' error...

fix 'RuntimeError: Expected all tensors to be on the same device' error preventing models from loading on lowvram/medvram.
parent 29a3a7eb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -298,6 +298,6 @@ class FrozenCLIPEmbedderWithCustomWords(FrozenCLIPEmbedderWithCustomWordsBase):
    def encode_embedding_init_text(self, init_text, nvpt):
        embedding_layer = self.wrapped.transformer.text_model.embeddings
        ids = self.wrapped.tokenizer(init_text, max_length=nvpt, return_tensors="pt", add_special_tokens=False)["input_ids"]
        embedded = embedding_layer.token_embedding.wrapped(ids.to(devices.device)).squeeze(0)
        embedded = embedding_layer.token_embedding.wrapped(ids.to(embedding_layer.token_embedding.wrapped.weight.device)).squeeze(0)

        return embedded