alibidaran commited on
Commit
5a66b61
·
1 Parent(s): bb79d4a

add initial values

Browse files
Files changed (3) hide show
  1. LORA_SDX1.5_Midjourney +1 -0
  2. app.py +10 -7
  3. requirements.txt +5 -1
LORA_SDX1.5_Midjourney ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 63323113c63d268a2e2cb18323b93db639d6e44e
app.py CHANGED
@@ -7,7 +7,11 @@ from diffusers import DiffusionPipeline
7
  import torch
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
- model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
 
 
 
 
11
 
12
  if torch.cuda.is_available():
13
  torch_dtype = torch.float16
@@ -18,13 +22,13 @@ 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
21
- MAX_IMAGE_SIZE = 1024
 
22
 
23
 
24
- # @spaces.GPU #[uncomment to use ZeroGPU]
25
  def infer(
26
  prompt,
27
- negative_prompt,
28
  seed,
29
  randomize_seed,
30
  width,
@@ -40,7 +44,6 @@ def infer(
40
 
41
  image = pipe(
42
  prompt=prompt,
43
- negative_prompt=negative_prompt,
44
  guidance_scale=guidance_scale,
45
  num_inference_steps=num_inference_steps,
46
  width=width,
@@ -105,7 +108,7 @@ with gr.Blocks(css=css) as demo:
105
  minimum=256,
106
  maximum=MAX_IMAGE_SIZE,
107
  step=32,
108
- value=1024, # Replace with defaults that work for your model
109
  )
110
 
111
  height = gr.Slider(
@@ -113,7 +116,7 @@ with gr.Blocks(css=css) as demo:
113
  minimum=256,
114
  maximum=MAX_IMAGE_SIZE,
115
  step=32,
116
- value=1024, # Replace with defaults that work for your model
117
  )
118
 
119
  with gr.Row():
 
7
  import torch
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
+ pre="runwayml/stable-diffusion-v1-5"
11
+ pipe = DiffusionPipeline.from_pretrained(
12
+ pre,
13
+ torch_dtype=torch.float16
14
+ ).to(device)
15
 
16
  if torch.cuda.is_available():
17
  torch_dtype = torch.float16
 
22
  pipe = pipe.to(device)
23
 
24
  MAX_SEED = np.iinfo(np.int32).max
25
+ MAX_IMAGE_SIZE = 512
26
+ pipe.load_lora_weights("/home/user/app/LORA_SDX1.5_Midjourney/lora/pytorch_lora_weights.safetensors")
27
 
28
 
29
+ @spaces.GPU #[uncomment to use ZeroGPU]
30
  def infer(
31
  prompt,
 
32
  seed,
33
  randomize_seed,
34
  width,
 
44
 
45
  image = pipe(
46
  prompt=prompt,
 
47
  guidance_scale=guidance_scale,
48
  num_inference_steps=num_inference_steps,
49
  width=width,
 
108
  minimum=256,
109
  maximum=MAX_IMAGE_SIZE,
110
  step=32,
111
+ value=512, # Replace with defaults that work for your model
112
  )
113
 
114
  height = gr.Slider(
 
116
  minimum=256,
117
  maximum=MAX_IMAGE_SIZE,
118
  step=32,
119
+ value=512, # Replace with defaults that work for your model
120
  )
121
 
122
  with gr.Row():
requirements.txt CHANGED
@@ -3,4 +3,8 @@ diffusers
3
  invisible_watermark
4
  torch
5
  transformers
6
- xformers
 
 
 
 
 
3
  invisible_watermark
4
  torch
5
  transformers
6
+ xformers
7
+ accelerate
8
+ peft
9
+ safetensors
10
+ bitsandbytes