eolecvk commited on
Commit
b2c07cc
·
2 Parent(s): 30e3689 a680d95

fix merge issues

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -3
  2. README.md +5 -5
  3. app.py +40 -14
  4. requirements.txt +12 -1
.gitattributes CHANGED
@@ -7,7 +7,6 @@
7
  *.h5 filter=lfs diff=lfs merge=lfs -text
8
  *.joblib filter=lfs diff=lfs merge=lfs -text
9
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
11
  *.model filter=lfs diff=lfs merge=lfs -text
12
  *.msgpack filter=lfs diff=lfs merge=lfs -text
13
  *.npy filter=lfs diff=lfs merge=lfs -text
@@ -15,13 +14,12 @@
15
  *.onnx filter=lfs diff=lfs merge=lfs -text
16
  *.ot filter=lfs diff=lfs merge=lfs -text
17
  *.parquet filter=lfs diff=lfs merge=lfs -text
18
- *.pb filter=lfs diff=lfs merge=lfs -text
19
  *.pickle filter=lfs diff=lfs merge=lfs -text
20
  *.pkl filter=lfs diff=lfs merge=lfs -text
 
21
  *.pt filter=lfs diff=lfs merge=lfs -text
22
  *.pth filter=lfs diff=lfs merge=lfs -text
23
  *.rar filter=lfs diff=lfs merge=lfs -text
24
- *.safetensors filter=lfs diff=lfs merge=lfs -text
25
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
26
  *.tar.* filter=lfs diff=lfs merge=lfs -text
27
  *.tflite filter=lfs diff=lfs merge=lfs -text
 
7
  *.h5 filter=lfs diff=lfs merge=lfs -text
8
  *.joblib filter=lfs diff=lfs merge=lfs -text
9
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
 
10
  *.model filter=lfs diff=lfs merge=lfs -text
11
  *.msgpack filter=lfs diff=lfs merge=lfs -text
12
  *.npy filter=lfs diff=lfs merge=lfs -text
 
14
  *.onnx filter=lfs diff=lfs merge=lfs -text
15
  *.ot filter=lfs diff=lfs merge=lfs -text
16
  *.parquet filter=lfs diff=lfs merge=lfs -text
 
17
  *.pickle filter=lfs diff=lfs merge=lfs -text
18
  *.pkl filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
  *.pt filter=lfs diff=lfs merge=lfs -text
21
  *.pth filter=lfs diff=lfs merge=lfs -text
22
  *.rar filter=lfs diff=lfs merge=lfs -text
 
23
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
  *.tar.* filter=lfs diff=lfs merge=lfs -text
25
  *.tflite filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
- title: Text To Naruto
3
- emoji: 🏃
4
- colorFrom: yellow
5
- colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 3.4
8
  app_file: app.py
9
  pinned: false
10
  ---
 
1
  ---
2
+ title: Text to Naruto
3
+ emoji: 🥷🏿
4
+ colorFrom: indigo
5
+ colorTo: green
6
  sdk: gradio
7
+ sdk_version: 3.5
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -2,18 +2,43 @@ from contextlib import nullcontext
2
  import gradio as gr
3
  import torch
4
  from torch import autocast
 
5
  from diffusers import StableDiffusionPipeline
 
 
 
6
 
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  context = autocast if device == "cuda" else nullcontext
10
  dtype = torch.float16 if device == "cuda" else torch.float32
11
 
 
12
  pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-pokemon-diffusers", torch_dtype=dtype)
13
  pipe = pipe.to(device)
14
 
15
 
16
  # Sometimes the nsfw checker is confused by the Pokémon images, you can disable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  # it at your own risk here
18
  disable_safety = True
19
 
@@ -115,35 +140,35 @@ block = gr.Blocks(css=css)
115
 
116
  examples = [
117
  [
118
- 'Yoda',
119
  2,
120
  7.5,
121
  ],
122
  [
123
- 'Abraham Lincoln',
124
  2,
125
  7.5,
126
  ],
127
  [
128
- 'George Washington',
129
  2,
130
- 7,
131
  ],
132
  ]
133
 
134
  with block:
135
  gr.HTML(
136
  """
137
- <div style="text-align: center; max-width: 650px; margin: 30;">
138
  <div>
139
- <img class="logo" src="https://lambdalabs.com/static/images/lambda-logo.svg" alt="Lambda Logo"
140
- style="margin: 30; max-width: 7rem;">
141
- <h1 style="font-weight: 900; font-size: 3rem; margin: 30;">
142
- Pokémon text to image
143
  </h1>
144
  </div>
145
- <p style="margin-bottom: 10px; font-size: 94%; margin: 30">
146
- Generate new Pokémon from a text description,
147
  <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">created by Lambda Labs</a>.
148
  </p>
149
  </div>
@@ -174,7 +199,7 @@ with block:
174
 
175
  with gr.Row(elem_id="advanced-options"):
176
  samples = gr.Slider(label="Images", minimum=1, maximum=4, value=2, step=1)
177
- steps = gr.Slider(label="Steps", minimum=5, maximum=50, value=25, step=5)
178
  scale = gr.Slider(
179
  label="Guidance Scale", minimum=0, maximum=50, value=7.5, step=0.1
180
  )
@@ -193,10 +218,11 @@ with block:
193
  </p>
194
  </div>
195
  <div class="acknowledgments">
196
- <p> Put in a text prompt and generate your own Pokémon character, no "prompt engineering" required!
 
197
  <p>If you want to find out how we made this model read about it in <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">this blog post</a>.
198
  <p>And if you want to train your own Stable Diffusion variants, see our <a href="https://github.com/LambdaLabsML/examples/tree/main/stable-diffusion-finetuning">Examples Repo</a>!
199
- <p>Trained by <a href="justinpinkney.com">Justin Pinkney</a> (<a href="https://twitter.com/Buntworthy">@Buntworthy</a>) at <a href="https://lambdalabs.com/">Lambda Labs</a>.</p>
200
  </div>
201
  """
202
  )
 
2
  import gradio as gr
3
  import torch
4
  from torch import autocast
5
+ <<<<<<< HEAD
6
  from diffusers import StableDiffusionPipeline
7
+ =======
8
+ from diffusers import StableDiffusionPipeline, StableDiffusionOnnxPipeline
9
+ >>>>>>> a680d9594c0ff489aea01c48f81a693c55dffb9d
10
 
11
 
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
  context = autocast if device == "cuda" else nullcontext
14
  dtype = torch.float16 if device == "cuda" else torch.float32
15
 
16
+ <<<<<<< HEAD
17
  pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-pokemon-diffusers", torch_dtype=dtype)
18
  pipe = pipe.to(device)
19
 
20
 
21
  # Sometimes the nsfw checker is confused by the Pokémon images, you can disable
22
+ =======
23
+ try:
24
+ if device == "cuda":
25
+ pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-naruto-diffusers", torch_dtype=dtype)
26
+
27
+ else:
28
+ pipe = StableDiffusionOnnxPipeline.from_pretrained(
29
+ "lambdalabs/sd-naruto-diffusers",
30
+ revision="onnx",
31
+ provider="CPUExecutionProvider"
32
+ )
33
+
34
+ # onnx model revision not available
35
+ except:
36
+ pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-naruto-diffusers", torch_dtype=dtype)
37
+
38
+ pipe = pipe.to(device)
39
+
40
+ # Sometimes the nsfw checker is confused by the Naruto images, you can disable
41
+ >>>>>>> a680d9594c0ff489aea01c48f81a693c55dffb9d
42
  # it at your own risk here
43
  disable_safety = True
44
 
 
140
 
141
  examples = [
142
  [
143
+ 'Bill Gates with a hoodie',
144
  2,
145
  7.5,
146
  ],
147
  [
148
+ 'Jon Snow ninja portrait',
149
  2,
150
  7.5,
151
  ],
152
  [
153
+ 'Leo Messi in the style of Naruto',
154
  2,
155
+ 7.5
156
  ],
157
  ]
158
 
159
  with block:
160
  gr.HTML(
161
  """
162
+ <div style="text-align: center; max-width: 650px; margin: 0 auto;">
163
  <div>
164
+ <img class="logo" src="https://lambdalabs.com/hubfs/logos/lambda-logo.svg" alt="Lambda Logo"
165
+ style="margin: auto; max-width: 7rem;">
166
+ <h1 style="font-weight: 900; font-size: 3rem;">
167
+ Naruto text to image
168
  </h1>
169
  </div>
170
+ <p style="margin-bottom: 10px; font-size: 94%">
171
+ Generate new Naruto anime character from a text description,
172
  <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">created by Lambda Labs</a>.
173
  </p>
174
  </div>
 
199
 
200
  with gr.Row(elem_id="advanced-options"):
201
  samples = gr.Slider(label="Images", minimum=1, maximum=4, value=2, step=1)
202
+ steps = gr.Slider(label="Steps", minimum=5, maximum=50, value=45, step=5)
203
  scale = gr.Slider(
204
  label="Guidance Scale", minimum=0, maximum=50, value=7.5, step=0.1
205
  )
 
218
  </p>
219
  </div>
220
  <div class="acknowledgments">
221
+ <p> Put in a text prompt and generate your own Naruto anime character!
222
+ <p> Here are some <a href="https://huggingface.co/lambdalabs/sd-naruto-diffusers">examples</a> of generated images.
223
  <p>If you want to find out how we made this model read about it in <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">this blog post</a>.
224
  <p>And if you want to train your own Stable Diffusion variants, see our <a href="https://github.com/LambdaLabsML/examples/tree/main/stable-diffusion-finetuning">Examples Repo</a>!
225
+ <p>Trained by Eole Cervenka at <a href="https://lambdalabs.com/">Lambda Labs</a>.</p>
226
  </div>
227
  """
228
  )
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  --extra-index-url https://download.pytorch.org/whl/cu116
2
  torch
3
  diffusers
@@ -8,4 +9,14 @@ datasets
8
  gradio==3.5
9
 
10
  # accelerate
11
- # ray[serve]
 
 
 
 
 
 
 
 
 
 
 
1
+ <<<<<<< HEAD
2
  --extra-index-url https://download.pytorch.org/whl/cu116
3
  torch
4
  diffusers
 
9
  gradio==3.5
10
 
11
  # accelerate
12
+ # ray[serve]
13
+ =======
14
+ --extra-index-url https://download.pytorch.org/whl/cu113
15
+ torch==1.12.1+cu113
16
+ diffusers==0.3.0
17
+ transformers==4.22.2
18
+ scipy==1.9.1
19
+ ftfy==6.1.1
20
+ datasets==2.5.1
21
+ onnxruntime==1.12.1
22
+ >>>>>>> a680d9594c0ff489aea01c48f81a693c55dffb9d