From b2c1456d4ab3a0def6121064adcc5cc12069266d Mon Sep 17 00:00:00 2001 From: erik Date: Fri, 10 Nov 2023 20:54:13 +0000 Subject: [PATCH] . --- scripts/convert_civit.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/convert_civit.py diff --git a/scripts/convert_civit.py b/scripts/convert_civit.py new file mode 100644 index 0000000..d2d2973 --- /dev/null +++ b/scripts/convert_civit.py @@ -0,0 +1,15 @@ +import subprocess +import sys +from diffusers import StableDiffusionXLPipeline +import hashlib + +if __name__ == "__main__": + modid = sys.argv[1] + name = sys.argv[2] + url = "gputopia/" + name + hashname = "sdxl." + hashlib.md5(url.encode()).hexdigest() + subprocess.run("wget -O tmp.st https://civitai.com/api/download/models/" + modid, shell=True) + pipe = StableDiffusionXLPipeline.from_single_file("tmp.st") + pipe.save_pretrained(hashname) + subprocess.run("tar -cf - {hashname}/ | pigz -9 - > {hashname}.tar.gz", shell=True) + subprocess.run("aws s3 cp {hashname}.tar.gz s3://gputopia/models/{name}.tar.gz", shell=True)