From: Nicolas Patry Date: Tue, 13 Dec 2022 16:17:42 +0000 (+0100) Subject: Fixing it for `diffusers`. (#130) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=846a64b937df6818787e7e0bdf88eaa97330f09d;p=safetensors.git Fixing it for `diffusers`. (#130) --- diff --git a/bindings/python/convert.py b/bindings/python/convert.py index a44593a..7cf4c3c 100644 --- a/bindings/python/convert.py +++ b/bindings/python/convert.py @@ -202,11 +202,11 @@ def convert_generic(model_id: str, folder: str, filenames: Set[str]) -> List["Co prefix, ext = os.path.splitext(filename) if ext in extensions: pt_filename = hf_hub_download(model_id, filename=filename) - _, raw_filename = os.path.split(filename) + dirname, raw_filename = os.path.split(filename) if raw_filename == "pytorch_model.bin": # XXX: This is a special case to handle `transformers` and the # `transformers` part of the model which is actually loaded by `transformers`. - sf_in_repo = "model.safetensors" + sf_in_repo = os.path.join(dirname, "model.safetensors") else: sf_in_repo = f"{prefix}.safetensors" sf_filename = os.path.join(folder, sf_in_repo)