From 846a64b937df6818787e7e0bdf88eaa97330f09d Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Tue, 13 Dec 2022 17:17:42 +0100 Subject: [PATCH] Fixing it for `diffusers`. (#130) --- bindings/python/convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) -- 2.43.0