patrickvonplaten commited on
Commit
b6badad
1 Parent(s): 18ff08e
Files changed (1) hide show
  1. run_local.py +6 -3
run_local.py CHANGED
@@ -4,21 +4,24 @@ import time
4
  from huggingface_hub import HfApi
5
  import torch
6
  import sys
 
7
 
8
  path = sys.argv[1]
9
 
10
  api = HfApi()
11
  start_time = time.time()
12
- pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)
13
  pipe.scheduler = HeunDiscreteScheduler.from_config(pipe.scheduler.config)
14
- pipe = pipe.to("cuda")
 
 
15
 
16
  prompt = "a highly realistic photo of green turtle"
17
  generator = torch.Generator(device="cuda").manual_seed(0)
18
  image = pipe(prompt, generator=generator, num_inference_steps=25).images[0]
19
  print("Time", time.time() - start_time)
20
 
21
- path = "/home/patrick_huggingface_co/images/aa.png"
22
  image.save(path)
23
 
24
  api.upload_file(
 
4
  from huggingface_hub import HfApi
5
  import torch
6
  import sys
7
+ from pathlib import Path
8
 
9
  path = sys.argv[1]
10
 
11
  api = HfApi()
12
  start_time = time.time()
13
+ pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16, device_map="auto")
14
  pipe.scheduler = HeunDiscreteScheduler.from_config(pipe.scheduler.config)
15
+ #pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)
16
+ #pipe.scheduler = HeunDiscreteScheduler.from_config(pipe.scheduler.config)
17
+ #pipe = pipe.to("cuda")
18
 
19
  prompt = "a highly realistic photo of green turtle"
20
  generator = torch.Generator(device="cuda").manual_seed(0)
21
  image = pipe(prompt, generator=generator, num_inference_steps=25).images[0]
22
  print("Time", time.time() - start_time)
23
 
24
+ path = os.path.join(Path.home(), "images", "aa.png")
25
  image.save(path)
26
 
27
  api.upload_file(