mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
Merge pull request #6625 from PlasmaPower/textual-inversion-safetensors
Support loading textual inversion embeddings from safetensors files
This commit is contained in:
commit
3e20244b0f
@ -9,6 +9,7 @@ import tqdm
|
||||
import html
|
||||
import datetime
|
||||
import csv
|
||||
import safetensors.torch
|
||||
|
||||
from PIL import Image, PngImagePlugin
|
||||
|
||||
@ -150,6 +151,8 @@ class EmbeddingDatabase:
|
||||
name = data.get('name', name)
|
||||
elif ext in ['.BIN', '.PT']:
|
||||
data = torch.load(path, map_location="cpu")
|
||||
elif ext in ['.SAFETENSORS']:
|
||||
data = safetensors.torch.load_file(path, device="cpu")
|
||||
else:
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user