MEOW4meow commited on
Commit
904f215
·
verified ·
1 Parent(s): a85e57d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -3,9 +3,14 @@ import numpy as np
3
  import random
4
 
5
  import spaces #[uncomment to use ZeroGPU]
6
- from diffusers import DiffusionPipeline
7
  import torch
8
 
 
 
 
 
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  model_repo_id = "Alpha-VLLM/Lumina-Image-2.0" # Replace to the model you would like to use
11
 
@@ -14,7 +19,9 @@ if torch.cuda.is_available():
14
  else:
15
  torch_dtype = torch.float32
16
 
17
- pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
 
 
18
  pipe = pipe.to(device)
19
 
20
  MAX_SEED = np.iinfo(np.int32).max
@@ -52,6 +59,7 @@ def infer(
52
 
53
 
54
  examples = [
 
55
  "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
56
  "An astronaut riding a green horse",
57
  "A delicious ceviche cheesecake slice",
 
3
  import random
4
 
5
  import spaces #[uncomment to use ZeroGPU]
6
+ from diffusers import Lumina2Text2ImgPipeline
7
  import torch
8
 
9
+ # //////////////////////////////////////////////////////////////////////////////
10
+
11
+
12
+
13
+ # //////////////////////////////////////////////////////////////////////////////
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  model_repo_id = "Alpha-VLLM/Lumina-Image-2.0" # Replace to the model you would like to use
16
 
 
19
  else:
20
  torch_dtype = torch.float32
21
 
22
+ pipe = Lumina2Text2ImgPipeline.from_pretrained("Alpha-VLLM/Lumina-Image-2.0", torch_dtype=torch.bfloat16)
23
+ # pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
24
+
25
  pipe = pipe.to(device)
26
 
27
  MAX_SEED = np.iinfo(np.int32).max
 
59
 
60
 
61
  examples = [
62
+ "A serene photograph capturing the golden reflection of the sun on a vast expanse of water. The sun is positioned at the top center, casting a brilliant, shimmering trail of light across the rippling surface. The water is textured with gentle waves, creating a rhythmic pattern that leads the eye towards the horizon. The entire scene is bathed in warm, golden hues, enhancing the tranquil and meditative atmosphere. High contrast, natural lighting, golden hour, photorealistic, expansive composition, reflective surface, peaceful, visually harmonious.",
63
  "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
64
  "An astronaut riding a green horse",
65
  "A delicious ceviche cheesecake slice",