From 7ef63e14c497f58e9d96a55a7418ff25f8f6326d Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 19 Feb 2023 12:29:15 -0600 Subject: [PATCH] fix(docs): note about checking LoRA metadata keys --- docs/converting-models.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/converting-models.md b/docs/converting-models.md index a84272f2..26cba85c 100644 --- a/docs/converting-models.md +++ b/docs/converting-models.md @@ -116,7 +116,19 @@ which can be converted into a diffusers directory and finally ONNX models. Weights exported by the two repositories are not compatible with the other and you must use the same scripts that originally created a set of weights to merge them. -Try the other repository if you get an error about missing metadata, for example: +If you have a `.safetensors` file, check the metadata keys: + +```python +>>> import safetensors +>>> t = safetensors.safe_open("/home/ssube/lora-weights/jack.safetensors", framework="pt") +>>> print(t.metadata()) +{'ss_batch_size_per_device': '1', 'ss_bucket_info': 'null', 'ss_cache_latents': 'True', 'ss_clip_skip': '2', ...} +``` + +If they start with `lora_`, it's probably from the `cloneofsimo/lora` scripts. If they start with `ss_`, it's +probably from the `kohya-ss/sd-scripts` scripts. + +If you get an error about missing metadata, try the other repository. For example: ```none warnings.warn(