patrickvonplaten commited on
Commit
6e1b3e5
1 Parent(s): 6d8ff37

correct vocab

Browse files
Files changed (2) hide show
  1. light_and_shadow.safetensors +3 -0
  2. run_lora +53 -0
light_and_shadow.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15a630ab2255460b2e99b1e5a6765a1cedcd210e2ffca32474bd02df24232624
3
+ size 151110122
run_lora ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from diffusers import StableDiffusionPipeline, KDPM2DiscreteScheduler, StableDiffusionImg2ImgPipeline, HeunDiscreteScheduler, KDPM2AncestralDiscreteScheduler, DDIMScheduler, DPMSolverMultistepScheduler
3
+ import time
4
+ import os
5
+ from huggingface_hub import HfApi
6
+ # from compel import Compel
7
+ import torch
8
+ import sys
9
+ from pathlib import Path
10
+ import requests
11
+ from PIL import Image
12
+ from io import BytesIO
13
+
14
+ # path = sys.argv[1]
15
+ path = "runwayml/stable-diffusion-v1-5"
16
+ # path = "stabilityai/stable-diffusion-2-1"
17
+
18
+ api = HfApi()
19
+ start_time = time.time()
20
+ pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)
21
+ pipe.scheduler = DPMSolverMultistepScheduler.from_config(
22
+ pipe.scheduler.config, use_karras_sigmas=True
23
+ )
24
+ pipe = pipe.to("cuda")
25
+
26
+ pipe.load_lora_weights(".", weight_name="light_and_shadow.safetensors")
27
+
28
+ prompt = "masterpiece, best quality, 1girl, at dusk"
29
+ negative_prompt = ("(low quality, worst quality:1.4), (bad anatomy), (inaccurate limb:1.2), "
30
+ "bad composition, inaccurate eyes, extra digit, fewer digits, (extra arms:1.2), large breasts")
31
+
32
+ images = pipe(prompt=prompt,
33
+ negative_prompt=negative_prompt,
34
+ width=512,
35
+ height=768,
36
+ num_inference_steps=15,
37
+ num_images_per_prompt=4,
38
+ generator=torch.manual_seed(0)
39
+ ).images
40
+
41
+
42
+ for i, image in enumerate(images):
43
+ file_name = f"aa_{i}"
44
+ path = os.path.join(Path.home(), "images", f"{file_name}.png")
45
+ image.save(path)
46
+
47
+ api.upload_file(
48
+ path_or_fileobj=path,
49
+ path_in_repo=path.split("/")[-1],
50
+ repo_id="patrickvonplaten/images",
51
+ repo_type="dataset",
52
+ )
53
+ print(f"https://huggingface.co/datasets/patrickvonplaten/images/blob/main/{file_name}.png")