Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
earonesty committed Nov 10, 2023
1 parent 73e7297 commit b2c1456
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/convert_civit.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b2c1456

Please sign in to comment.