ariG23498 HF Staff commited on
Commit
ff529c3
·
verified ·
1 Parent(s): 25f5828

Upload peteromallet_Qwen-Image-Edit-InScene_0.py with huggingface_hub

Browse files
peteromallet_Qwen-Image-Edit-InScene_0.py CHANGED
@@ -4,6 +4,8 @@
4
  # "numpy",
5
  # "einops",
6
  # "pandas",
 
 
7
  # "protobuf",
8
  # "torch",
9
  # "sentencepiece",
@@ -19,10 +21,12 @@
19
  # ///
20
 
21
  try:
 
22
  from diffusers import DiffusionPipeline
23
  from diffusers.utils import load_image
24
 
25
- pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
 
26
  pipe.load_lora_weights("peteromallet/Qwen-Image-Edit-InScene")
27
 
28
  prompt = "Turn this cat into a dog"
@@ -43,10 +47,12 @@ except Exception as e:
43
  with open('peteromallet_Qwen-Image-Edit-InScene_0.txt', 'a', encoding='utf-8') as f:
44
  import traceback
45
  f.write('''```CODE:
 
46
  from diffusers import DiffusionPipeline
47
  from diffusers.utils import load_image
48
 
49
- pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
 
50
  pipe.load_lora_weights("peteromallet/Qwen-Image-Edit-InScene")
51
 
52
  prompt = "Turn this cat into a dog"
 
4
  # "numpy",
5
  # "einops",
6
  # "pandas",
7
+ # "matplotlib",
8
+ # "paddleorc",
9
  # "protobuf",
10
  # "torch",
11
  # "sentencepiece",
 
21
  # ///
22
 
23
  try:
24
+ import torch
25
  from diffusers import DiffusionPipeline
26
  from diffusers.utils import load_image
27
 
28
+ # switch to "mps" for apple devices
29
+ pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit", dtype=torch.bfloat16, device_map="cuda")
30
  pipe.load_lora_weights("peteromallet/Qwen-Image-Edit-InScene")
31
 
32
  prompt = "Turn this cat into a dog"
 
47
  with open('peteromallet_Qwen-Image-Edit-InScene_0.txt', 'a', encoding='utf-8') as f:
48
  import traceback
49
  f.write('''```CODE:
50
+ import torch
51
  from diffusers import DiffusionPipeline
52
  from diffusers.utils import load_image
53
 
54
+ # switch to "mps" for apple devices
55
+ pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit", dtype=torch.bfloat16, device_map="cuda")
56
  pipe.load_lora_weights("peteromallet/Qwen-Image-Edit-InScene")
57
 
58
  prompt = "Turn this cat into a dog"