Commit 3e20244b authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub

Merge pull request #6625 from PlasmaPower/textual-inversion-safetensors

Support loading textual inversion embeddings from safetensors files
parents 9757c0b3 f9706acf
...@@ -9,6 +9,7 @@ import tqdm ...@@ -9,6 +9,7 @@ import tqdm
import html import html
import datetime import datetime
import csv import csv
import safetensors.torch
from PIL import Image, PngImagePlugin from PIL import Image, PngImagePlugin
...@@ -150,6 +151,8 @@ class EmbeddingDatabase: ...@@ -150,6 +151,8 @@ class EmbeddingDatabase:
name = data.get('name', name) name = data.get('name', name)
elif ext in ['.BIN', '.PT']: elif ext in ['.BIN', '.PT']:
data = torch.load(path, map_location="cpu") data = torch.load(path, map_location="cpu")
elif ext in ['.SAFETENSORS']:
data = safetensors.torch.load_file(path, device="cpu")
else: else:
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment