Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files- hf_demo.py +23 -8
- hf_demo_test.ipynb +347 -48
hf_demo.py
CHANGED
@@ -104,7 +104,14 @@ def demo_inference_stylization_artistic(ref_image, adapter_choice:str, prompt:st
|
|
104 |
from_scratch=False, device=device, weight_dtype=dtype)[0][adapter_scale][0]
|
105 |
return pred_images
|
106 |
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
|
110 |
block = gr.Blocks()
|
@@ -234,25 +241,33 @@ with block:
|
|
234 |
examples = gr.Examples(
|
235 |
examples=[
|
236 |
["Snow-covered trees with sunlight shining through",
|
237 |
-
"data/Snow-covered_trees_with_sunlight_shining_through.jpg"
|
238 |
],
|
239 |
["A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.",
|
240 |
-
"data/0011772.jpg"
|
|
|
241 |
["a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.",
|
242 |
-
"data/a_black_SUV_driving_down_a_highway_with_a_scenic_view_of_mountains_and_water_in_the_background._The_.jpg"
|
243 |
],
|
244 |
[
|
245 |
"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.",
|
246 |
-
"data/003904765.jpg"
|
247 |
]
|
248 |
|
249 |
],
|
250 |
inputs=[
|
251 |
text,
|
252 |
-
gallery_stylization_ref
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
],
|
254 |
-
|
|
|
|
|
255 |
)
|
256 |
-
|
257 |
block.launch()
|
258 |
# block.launch(sharing=True)
|
|
|
104 |
from_scratch=False, device=device, weight_dtype=dtype)[0][adapter_scale][0]
|
105 |
return pred_images
|
106 |
|
107 |
+
@spaces.GPU
|
108 |
+
def demo_inference_all(prompt:str, ref_image, adapter_choice="Andre Derain (fauvism)", seed:int=0, steps=20, guidance_scale=7.5, adapter_scale=1.0,start_noise=800):
|
109 |
+
results = []
|
110 |
+
results.append(demo_inference_gen_ori(prompt, seed, steps, guidance_scale))
|
111 |
+
results.append(demo_inference_gen_artistic(adapter_choice, prompt, seed, steps, guidance_scale, adapter_scale))
|
112 |
+
results.append(demo_inference_stylization_ori(ref_image, prompt, seed, steps, guidance_scale, start_noise))
|
113 |
+
results.append(demo_inference_stylization_artistic(ref_image, adapter_choice, prompt, seed, steps, guidance_scale, adapter_scale, start_noise))
|
114 |
+
return results
|
115 |
|
116 |
|
117 |
block = gr.Blocks()
|
|
|
241 |
examples = gr.Examples(
|
242 |
examples=[
|
243 |
["Snow-covered trees with sunlight shining through",
|
244 |
+
"data/Snow-covered_trees_with_sunlight_shining_through.jpg",
|
245 |
],
|
246 |
["A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.",
|
247 |
+
"data/0011772.jpg",
|
248 |
+
],
|
249 |
["a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.",
|
250 |
+
"data/a_black_SUV_driving_down_a_highway_with_a_scenic_view_of_mountains_and_water_in_the_background._The_.jpg",
|
251 |
],
|
252 |
[
|
253 |
"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.",
|
254 |
+
"data/003904765.jpg",
|
255 |
]
|
256 |
|
257 |
],
|
258 |
inputs=[
|
259 |
text,
|
260 |
+
gallery_stylization_ref,
|
261 |
+
adapter_choice,
|
262 |
+
seed,
|
263 |
+
steps,
|
264 |
+
scale,
|
265 |
+
adapter_scale,
|
266 |
+
start_timestep,
|
267 |
],
|
268 |
+
fn=demo_inference_all,
|
269 |
+
outputs=[gallery_gen_ori, gallery_gen_art, gallery_stylization_ori, gallery_stylization_art],
|
270 |
+
cache_examples=True,
|
271 |
)
|
|
|
272 |
block.launch()
|
273 |
# block.launch(sharing=True)
|
hf_demo_test.ipynb
CHANGED
@@ -72,7 +72,7 @@
|
|
72 |
{
|
73 |
"data": {
|
74 |
"application/vnd.jupyter.widget-view+json": {
|
75 |
-
"model_id": "
|
76 |
"version_major": 2,
|
77 |
"version_minor": 0
|
78 |
},
|
@@ -91,7 +91,7 @@
|
|
91 |
},
|
92 |
{
|
93 |
"cell_type": "code",
|
94 |
-
"execution_count":
|
95 |
"id": "83916bc68ff5d914",
|
96 |
"metadata": {
|
97 |
"ExecuteTime": {
|
@@ -192,12 +192,20 @@
|
|
192 |
" start_noise=start_noise, show=False, style_prompt=style_prompt, no_load=True,\n",
|
193 |
" from_scratch=False, device=device, weight_dtype=dtype)[0][1.0][0]\n",
|
194 |
" return pred_images\n",
|
195 |
-
"\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
]
|
197 |
},
|
198 |
{
|
199 |
"cell_type": "code",
|
200 |
-
"execution_count":
|
201 |
"id": "aa33e9d104023847",
|
202 |
"metadata": {
|
203 |
"ExecuteTime": {
|
@@ -206,46 +214,192 @@
|
|
206 |
}
|
207 |
},
|
208 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
{
|
210 |
"name": "stdout",
|
211 |
"output_type": "stream",
|
212 |
"text": [
|
213 |
-
"
|
214 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
"\n",
|
216 |
-
"
|
217 |
]
|
218 |
},
|
219 |
{
|
220 |
-
"
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
"
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
230 |
},
|
231 |
{
|
232 |
-
"
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
},
|
239 |
{
|
240 |
"name": "stdout",
|
241 |
"output_type": "stream",
|
242 |
"text": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
"Train method: None\n",
|
244 |
"Rank: 1, Alpha: 1\n",
|
245 |
"create LoRA for U-Net: 0 modules.\n",
|
246 |
-
"current time: 2024-12-14
|
247 |
"save dir: None\n",
|
248 |
-
"[\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.\"], seed=
|
249 |
]
|
250 |
},
|
251 |
{
|
@@ -253,21 +407,43 @@
|
|
253 |
"output_type": "stream",
|
254 |
"text": [
|
255 |
"\n",
|
256 |
-
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:
|
257 |
]
|
258 |
},
|
259 |
{
|
260 |
"name": "stdout",
|
261 |
"output_type": "stream",
|
262 |
"text": [
|
263 |
-
"Time taken for one batch, Art Adapter scale=0.0:
|
264 |
"Train method: all_up\n",
|
265 |
"Rank: 1, Alpha: 1.0\n",
|
266 |
"create LoRA for U-Net: 123 modules.\n",
|
267 |
"Missing: <All keys matched successfully>\n",
|
268 |
-
"current time: 2024-12-14
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
"save dir: None\n",
|
270 |
-
"[
|
271 |
]
|
272 |
},
|
273 |
{
|
@@ -275,77 +451,191 @@
|
|
275 |
"output_type": "stream",
|
276 |
"text": [
|
277 |
"\n",
|
278 |
-
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:
|
279 |
]
|
280 |
},
|
281 |
{
|
282 |
"name": "stdout",
|
283 |
"output_type": "stream",
|
284 |
"text": [
|
285 |
-
"Time taken for one batch, Art Adapter scale=
|
286 |
"Train method: all_up\n",
|
287 |
"Rank: 1, Alpha: 1.0\n",
|
288 |
"create LoRA for U-Net: 123 modules.\n",
|
289 |
"Missing: <All keys matched successfully>\n",
|
290 |
-
"current time: 2024-12-14
|
291 |
"save dir: None\n",
|
292 |
-
"[
|
293 |
]
|
294 |
},
|
295 |
{
|
296 |
"name": "stderr",
|
297 |
"output_type": "stream",
|
298 |
"text": [
|
299 |
-
"
|
|
|
300 |
]
|
301 |
},
|
302 |
{
|
303 |
"name": "stdout",
|
304 |
"output_type": "stream",
|
305 |
"text": [
|
306 |
-
"Time taken for one batch, Art Adapter scale=1:
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
]
|
308 |
},
|
309 |
{
|
310 |
"name": "stderr",
|
311 |
"output_type": "stream",
|
312 |
"text": [
|
313 |
-
"\n"
|
|
|
314 |
]
|
315 |
},
|
316 |
{
|
317 |
"name": "stdout",
|
318 |
"output_type": "stream",
|
319 |
"text": [
|
|
|
320 |
"Train method: all_up\n",
|
321 |
"Rank: 1, Alpha: 1.0\n",
|
322 |
"create LoRA for U-Net: 123 modules.\n",
|
323 |
"Missing: <All keys matched successfully>\n",
|
324 |
-
"current time: 2024-12-14
|
325 |
"save dir: None\n",
|
326 |
-
"[
|
327 |
]
|
328 |
},
|
329 |
{
|
330 |
"name": "stderr",
|
331 |
"output_type": "stream",
|
332 |
"text": [
|
333 |
-
"
|
|
|
334 |
]
|
335 |
},
|
336 |
{
|
337 |
"name": "stdout",
|
338 |
"output_type": "stream",
|
339 |
"text": [
|
340 |
-
"Time taken for one batch, Art Adapter scale=1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
]
|
342 |
},
|
343 |
{
|
344 |
"name": "stderr",
|
345 |
"output_type": "stream",
|
346 |
"text": [
|
347 |
-
"\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
}
|
350 |
],
|
351 |
"source": [
|
@@ -435,7 +725,7 @@
|
|
435 |
" height=\"auto\",\n",
|
436 |
" scale=1,\n",
|
437 |
" )\n",
|
438 |
-
" start_timestep = gr.Slider(label=\"
|
439 |
" with gr.Row():\n",
|
440 |
" btn_style_ori = gr.Button(\"Art-Free Stylize\", scale=1)\n",
|
441 |
" btn_style_art = gr.Button(\"Artistic Stylize\", scale=1)\n",
|
@@ -477,24 +767,33 @@
|
|
477 |
" examples = gr.Examples(\n",
|
478 |
" examples=[\n",
|
479 |
" [\"Snow-covered trees with sunlight shining through\",\n",
|
480 |
-
" \"data/Snow-covered_trees_with_sunlight_shining_through.jpg\"
|
481 |
" ],\n",
|
482 |
" [\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.\",\n",
|
483 |
-
" \"data/0011772.jpg\"
|
|
|
484 |
" [\"a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.\",\n",
|
485 |
-
" \"data/a_black_SUV_driving_down_a_highway_with_a_scenic_view_of_mountains_and_water_in_the_background._The_.jpg\"
|
486 |
" ],\n",
|
487 |
" [\n",
|
488 |
" \"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.\",\n",
|
489 |
-
" \"data/003904765.jpg\"
|
490 |
" ]\n",
|
491 |
"\n",
|
492 |
" ],\n",
|
493 |
" inputs=[\n",
|
494 |
" text,\n",
|
495 |
-
" gallery_stylization_ref
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
" ],\n",
|
497 |
-
"
|
|
|
|
|
498 |
" )\n",
|
499 |
"block.launch(share=True)"
|
500 |
]
|
|
|
72 |
{
|
73 |
"data": {
|
74 |
"application/vnd.jupyter.widget-view+json": {
|
75 |
+
"model_id": "21523c1459824498a59b1d237927a48e",
|
76 |
"version_major": 2,
|
77 |
"version_minor": 0
|
78 |
},
|
|
|
91 |
},
|
92 |
{
|
93 |
"cell_type": "code",
|
94 |
+
"execution_count": 21,
|
95 |
"id": "83916bc68ff5d914",
|
96 |
"metadata": {
|
97 |
"ExecuteTime": {
|
|
|
192 |
" start_noise=start_noise, show=False, style_prompt=style_prompt, no_load=True,\n",
|
193 |
" from_scratch=False, device=device, weight_dtype=dtype)[0][1.0][0]\n",
|
194 |
" return pred_images\n",
|
195 |
+
"\n",
|
196 |
+
"\n",
|
197 |
+
"def demo_inference_all(prompt:str, ref_image, adapter_choice=\"Andre Derain (fauvism)\", seed:int=0, steps=20, guidance_scale=7.5, adapter_scale=1.0,start_noise=800):\n",
|
198 |
+
" results = []\n",
|
199 |
+
" results.append(demo_inference_gen_ori(prompt, seed, steps, guidance_scale))\n",
|
200 |
+
" results.append(demo_inference_gen_artistic(adapter_choice, prompt, seed, steps, guidance_scale, adapter_scale))\n",
|
201 |
+
" results.append(demo_inference_stylization_ori(ref_image, prompt, seed, steps, guidance_scale, start_noise))\n",
|
202 |
+
" results.append(demo_inference_stylization_artistic(ref_image, adapter_choice, prompt, seed, steps, guidance_scale, adapter_scale, start_noise))\n",
|
203 |
+
" return results"
|
204 |
]
|
205 |
},
|
206 |
{
|
207 |
"cell_type": "code",
|
208 |
+
"execution_count": 22,
|
209 |
"id": "aa33e9d104023847",
|
210 |
"metadata": {
|
211 |
"ExecuteTime": {
|
|
|
214 |
}
|
215 |
},
|
216 |
"outputs": [
|
217 |
+
{
|
218 |
+
"name": "stderr",
|
219 |
+
"output_type": "stream",
|
220 |
+
"text": [
|
221 |
+
"/data/vision/torralba/selfmanaged/torralba/scratch/jomat/sam_dataset/miniforge3/envs/diffusion/lib/python3.9/site-packages/gradio/helpers.py:370: UserWarning: Examples will be cached but not all input components have example values. This may result in an exception being thrown by your function. If you do get an error while caching examples, make sure all of your inputs have example values for all of your examples or you provide default values for those particular parameters in your function.\n",
|
222 |
+
" warnings.warn(\n"
|
223 |
+
]
|
224 |
+
},
|
225 |
+
{
|
226 |
+
"name": "stdout",
|
227 |
+
"output_type": "stream",
|
228 |
+
"text": [
|
229 |
+
"Caching examples at: '/data/vision/torralba/selfmanaged/torralba/projects/jomat/hui/stable_diffusion/release/hf_demo/gradio_cached_examples/589'\n",
|
230 |
+
"Caching example 1/4\n",
|
231 |
+
"Train method: None\n",
|
232 |
+
"Rank: 1, Alpha: 1\n",
|
233 |
+
"create LoRA for U-Net: 0 modules.\n",
|
234 |
+
"current time: 2024-12-14 01:19:01\n",
|
235 |
+
"save dir: None\n",
|
236 |
+
"['Snow-covered trees with sunlight shining through'], seed=0\n"
|
237 |
+
]
|
238 |
+
},
|
239 |
+
{
|
240 |
+
"name": "stderr",
|
241 |
+
"output_type": "stream",
|
242 |
+
"text": [
|
243 |
+
"100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 8.41it/s]"
|
244 |
+
]
|
245 |
+
},
|
246 |
+
{
|
247 |
+
"name": "stdout",
|
248 |
+
"output_type": "stream",
|
249 |
+
"text": [
|
250 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.58335280418396\n"
|
251 |
+
]
|
252 |
+
},
|
253 |
+
{
|
254 |
+
"name": "stderr",
|
255 |
+
"output_type": "stream",
|
256 |
+
"text": [
|
257 |
+
"\n"
|
258 |
+
]
|
259 |
+
},
|
260 |
+
{
|
261 |
+
"name": "stdout",
|
262 |
+
"output_type": "stream",
|
263 |
+
"text": [
|
264 |
+
"Train method: all_up\n",
|
265 |
+
"Rank: 1, Alpha: 1.0\n",
|
266 |
+
"create LoRA for U-Net: 123 modules.\n",
|
267 |
+
"Missing: <All keys matched successfully>\n",
|
268 |
+
"current time: 2024-12-14 01:19:04\n",
|
269 |
+
"save dir: None\n",
|
270 |
+
"['Snow-covered trees with sunlight shining through in the style of sks art'], seed=0\n"
|
271 |
+
]
|
272 |
+
},
|
273 |
+
{
|
274 |
+
"name": "stderr",
|
275 |
+
"output_type": "stream",
|
276 |
+
"text": [
|
277 |
+
"100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 8.20it/s]"
|
278 |
+
]
|
279 |
+
},
|
280 |
+
{
|
281 |
+
"name": "stdout",
|
282 |
+
"output_type": "stream",
|
283 |
+
"text": [
|
284 |
+
"Time taken for one batch, Art Adapter scale=1.0: 2.6419241428375244\n"
|
285 |
+
]
|
286 |
+
},
|
287 |
+
{
|
288 |
+
"name": "stderr",
|
289 |
+
"output_type": "stream",
|
290 |
+
"text": [
|
291 |
+
"\n"
|
292 |
+
]
|
293 |
+
},
|
294 |
{
|
295 |
"name": "stdout",
|
296 |
"output_type": "stream",
|
297 |
"text": [
|
298 |
+
"Train method: None\n",
|
299 |
+
"Rank: 1, Alpha: 1\n",
|
300 |
+
"create LoRA for U-Net: 0 modules.\n",
|
301 |
+
"current time: 2024-12-14 01:19:07\n",
|
302 |
+
"save dir: None\n",
|
303 |
+
"['Snow-covered trees with sunlight shining through'], seed=0\n"
|
304 |
+
]
|
305 |
+
},
|
306 |
+
{
|
307 |
+
"name": "stderr",
|
308 |
+
"output_type": "stream",
|
309 |
+
"text": [
|
310 |
+
"100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:01<00:00, 10.71it/s]"
|
311 |
+
]
|
312 |
+
},
|
313 |
+
{
|
314 |
+
"name": "stdout",
|
315 |
+
"output_type": "stream",
|
316 |
+
"text": [
|
317 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.0403149127960205\n"
|
318 |
+
]
|
319 |
+
},
|
320 |
+
{
|
321 |
+
"name": "stderr",
|
322 |
+
"output_type": "stream",
|
323 |
+
"text": [
|
324 |
+
"\n"
|
325 |
+
]
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"name": "stdout",
|
329 |
+
"output_type": "stream",
|
330 |
+
"text": [
|
331 |
+
"Train method: all_up\n",
|
332 |
+
"Rank: 1, Alpha: 1.0\n",
|
333 |
+
"create LoRA for U-Net: 123 modules.\n",
|
334 |
+
"Missing: <All keys matched successfully>\n",
|
335 |
+
"current time: 2024-12-14 01:19:09\n",
|
336 |
+
"save dir: None\n",
|
337 |
+
"['Snow-covered trees with sunlight shining through in the style of sks art'], seed=0\n"
|
338 |
+
]
|
339 |
+
},
|
340 |
+
{
|
341 |
+
"name": "stderr",
|
342 |
+
"output_type": "stream",
|
343 |
+
"text": [
|
344 |
"\n",
|
345 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 9.96it/s]"
|
346 |
]
|
347 |
},
|
348 |
{
|
349 |
+
"name": "stdout",
|
350 |
+
"output_type": "stream",
|
351 |
+
"text": [
|
352 |
+
"Time taken for one batch, Art Adapter scale=1.0: 2.1876306533813477\n",
|
353 |
+
"Caching example 2/4\n",
|
354 |
+
"Train method: None\n",
|
355 |
+
"Rank: 1, Alpha: 1\n",
|
356 |
+
"create LoRA for U-Net: 0 modules.\n",
|
357 |
+
"current time: 2024-12-14 01:19:12\n",
|
358 |
+
"save dir: None\n",
|
359 |
+
"[\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.\"], seed=0\n"
|
360 |
+
]
|
361 |
},
|
362 |
{
|
363 |
+
"name": "stderr",
|
364 |
+
"output_type": "stream",
|
365 |
+
"text": [
|
366 |
+
"\n",
|
367 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 7.57it/s]"
|
368 |
+
]
|
369 |
},
|
370 |
{
|
371 |
"name": "stdout",
|
372 |
"output_type": "stream",
|
373 |
"text": [
|
374 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.8535258769989014\n",
|
375 |
+
"Train method: all_up\n",
|
376 |
+
"Rank: 1, Alpha: 1.0\n",
|
377 |
+
"create LoRA for U-Net: 123 modules.\n",
|
378 |
+
"Missing: <All keys matched successfully>\n",
|
379 |
+
"current time: 2024-12-14 01:19:15\n",
|
380 |
+
"save dir: None\n",
|
381 |
+
"[\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity in the style of sks art\"], seed=0\n"
|
382 |
+
]
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"name": "stderr",
|
386 |
+
"output_type": "stream",
|
387 |
+
"text": [
|
388 |
+
"\n",
|
389 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 7.09it/s]"
|
390 |
+
]
|
391 |
+
},
|
392 |
+
{
|
393 |
+
"name": "stdout",
|
394 |
+
"output_type": "stream",
|
395 |
+
"text": [
|
396 |
+
"Time taken for one batch, Art Adapter scale=1.0: 3.0402302742004395\n",
|
397 |
"Train method: None\n",
|
398 |
"Rank: 1, Alpha: 1\n",
|
399 |
"create LoRA for U-Net: 0 modules.\n",
|
400 |
+
"current time: 2024-12-14 01:19:18\n",
|
401 |
"save dir: None\n",
|
402 |
+
"[\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.\"], seed=0\n"
|
403 |
]
|
404 |
},
|
405 |
{
|
|
|
407 |
"output_type": "stream",
|
408 |
"text": [
|
409 |
"\n",
|
410 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 9.29it/s]"
|
411 |
]
|
412 |
},
|
413 |
{
|
414 |
"name": "stdout",
|
415 |
"output_type": "stream",
|
416 |
"text": [
|
417 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.33781099319458\n",
|
418 |
"Train method: all_up\n",
|
419 |
"Rank: 1, Alpha: 1.0\n",
|
420 |
"create LoRA for U-Net: 123 modules.\n",
|
421 |
"Missing: <All keys matched successfully>\n",
|
422 |
+
"current time: 2024-12-14 01:19:21\n",
|
423 |
+
"save dir: None\n",
|
424 |
+
"[\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity in the style of sks art\"], seed=0\n"
|
425 |
+
]
|
426 |
+
},
|
427 |
+
{
|
428 |
+
"name": "stderr",
|
429 |
+
"output_type": "stream",
|
430 |
+
"text": [
|
431 |
+
"\n",
|
432 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 8.70it/s]"
|
433 |
+
]
|
434 |
+
},
|
435 |
+
{
|
436 |
+
"name": "stdout",
|
437 |
+
"output_type": "stream",
|
438 |
+
"text": [
|
439 |
+
"Time taken for one batch, Art Adapter scale=1.0: 2.490582227706909\n",
|
440 |
+
"Caching example 3/4\n",
|
441 |
+
"Train method: None\n",
|
442 |
+
"Rank: 1, Alpha: 1\n",
|
443 |
+
"create LoRA for U-Net: 0 modules.\n",
|
444 |
+
"current time: 2024-12-14 01:19:24\n",
|
445 |
"save dir: None\n",
|
446 |
+
"['a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.'], seed=0\n"
|
447 |
]
|
448 |
},
|
449 |
{
|
|
|
451 |
"output_type": "stream",
|
452 |
"text": [
|
453 |
"\n",
|
454 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:03<00:00, 6.56it/s]"
|
455 |
]
|
456 |
},
|
457 |
{
|
458 |
"name": "stdout",
|
459 |
"output_type": "stream",
|
460 |
"text": [
|
461 |
+
"Time taken for one batch, Art Adapter scale=0.0: 3.2783615589141846\n",
|
462 |
"Train method: all_up\n",
|
463 |
"Rank: 1, Alpha: 1.0\n",
|
464 |
"create LoRA for U-Net: 123 modules.\n",
|
465 |
"Missing: <All keys matched successfully>\n",
|
466 |
+
"current time: 2024-12-14 01:19:27\n",
|
467 |
"save dir: None\n",
|
468 |
+
"['a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys in the style of sks art'], seed=0\n"
|
469 |
]
|
470 |
},
|
471 |
{
|
472 |
"name": "stderr",
|
473 |
"output_type": "stream",
|
474 |
"text": [
|
475 |
+
"\n",
|
476 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:03<00:00, 6.22it/s]"
|
477 |
]
|
478 |
},
|
479 |
{
|
480 |
"name": "stdout",
|
481 |
"output_type": "stream",
|
482 |
"text": [
|
483 |
+
"Time taken for one batch, Art Adapter scale=1.0: 3.4552266597747803\n",
|
484 |
+
"Train method: None\n",
|
485 |
+
"Rank: 1, Alpha: 1\n",
|
486 |
+
"create LoRA for U-Net: 0 modules.\n",
|
487 |
+
"current time: 2024-12-14 01:19:31\n",
|
488 |
+
"save dir: None\n",
|
489 |
+
"['a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.'], seed=0\n"
|
490 |
]
|
491 |
},
|
492 |
{
|
493 |
"name": "stderr",
|
494 |
"output_type": "stream",
|
495 |
"text": [
|
496 |
+
"\n",
|
497 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 8.18it/s]"
|
498 |
]
|
499 |
},
|
500 |
{
|
501 |
"name": "stdout",
|
502 |
"output_type": "stream",
|
503 |
"text": [
|
504 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.6474156379699707\n",
|
505 |
"Train method: all_up\n",
|
506 |
"Rank: 1, Alpha: 1.0\n",
|
507 |
"create LoRA for U-Net: 123 modules.\n",
|
508 |
"Missing: <All keys matched successfully>\n",
|
509 |
+
"current time: 2024-12-14 01:19:34\n",
|
510 |
"save dir: None\n",
|
511 |
+
"['a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys in the style of sks art'], seed=0\n"
|
512 |
]
|
513 |
},
|
514 |
{
|
515 |
"name": "stderr",
|
516 |
"output_type": "stream",
|
517 |
"text": [
|
518 |
+
"\n",
|
519 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 7.71it/s]"
|
520 |
]
|
521 |
},
|
522 |
{
|
523 |
"name": "stdout",
|
524 |
"output_type": "stream",
|
525 |
"text": [
|
526 |
+
"Time taken for one batch, Art Adapter scale=1.0: 2.803696870803833\n",
|
527 |
+
"Caching example 4/4\n",
|
528 |
+
"Train method: None\n",
|
529 |
+
"Rank: 1, Alpha: 1\n",
|
530 |
+
"create LoRA for U-Net: 0 modules.\n",
|
531 |
+
"current time: 2024-12-14 01:19:37\n",
|
532 |
+
"save dir: None\n",
|
533 |
+
"[\"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.\"], seed=0\n"
|
534 |
]
|
535 |
},
|
536 |
{
|
537 |
"name": "stderr",
|
538 |
"output_type": "stream",
|
539 |
"text": [
|
540 |
+
"\n",
|
541 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:03<00:00, 5.88it/s]"
|
542 |
+
]
|
543 |
+
},
|
544 |
+
{
|
545 |
+
"name": "stdout",
|
546 |
+
"output_type": "stream",
|
547 |
+
"text": [
|
548 |
+
"Time taken for one batch, Art Adapter scale=0.0: 3.648933172225952\n",
|
549 |
+
"Train method: all_up\n",
|
550 |
+
"Rank: 1, Alpha: 1.0\n",
|
551 |
+
"create LoRA for U-Net: 123 modules.\n",
|
552 |
+
"Missing: <All keys matched successfully>\n",
|
553 |
+
"current time: 2024-12-14 01:19:41\n",
|
554 |
+
"save dir: None\n",
|
555 |
+
"[\"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape in the style of sks art\"], seed=0\n"
|
556 |
+
]
|
557 |
+
},
|
558 |
+
{
|
559 |
+
"name": "stderr",
|
560 |
+
"output_type": "stream",
|
561 |
+
"text": [
|
562 |
+
"\n",
|
563 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:03<00:00, 5.57it/s]"
|
564 |
+
]
|
565 |
+
},
|
566 |
+
{
|
567 |
+
"name": "stdout",
|
568 |
+
"output_type": "stream",
|
569 |
+
"text": [
|
570 |
+
"Time taken for one batch, Art Adapter scale=1.0: 3.8492958545684814\n",
|
571 |
+
"Train method: None\n",
|
572 |
+
"Rank: 1, Alpha: 1\n",
|
573 |
+
"create LoRA for U-Net: 0 modules.\n",
|
574 |
+
"current time: 2024-12-14 01:19:45\n",
|
575 |
+
"save dir: None\n",
|
576 |
+
"[\"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.\"], seed=0\n"
|
577 |
+
]
|
578 |
+
},
|
579 |
+
{
|
580 |
+
"name": "stderr",
|
581 |
+
"output_type": "stream",
|
582 |
+
"text": [
|
583 |
+
"\n",
|
584 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:02<00:00, 7.32it/s]"
|
585 |
+
]
|
586 |
+
},
|
587 |
+
{
|
588 |
+
"name": "stdout",
|
589 |
+
"output_type": "stream",
|
590 |
+
"text": [
|
591 |
+
"Time taken for one batch, Art Adapter scale=0.0: 2.9497482776641846\n",
|
592 |
+
"Train method: all_up\n",
|
593 |
+
"Rank: 1, Alpha: 1.0\n",
|
594 |
+
"create LoRA for U-Net: 123 modules.\n",
|
595 |
+
"Missing: <All keys matched successfully>\n",
|
596 |
+
"current time: 2024-12-14 01:19:49\n",
|
597 |
+
"save dir: None\n",
|
598 |
+
"[\"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape in the style of sks art\"], seed=0\n"
|
599 |
]
|
600 |
+
},
|
601 |
+
{
|
602 |
+
"name": "stderr",
|
603 |
+
"output_type": "stream",
|
604 |
+
"text": [
|
605 |
+
"\n",
|
606 |
+
"00%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 21/21 [00:03<00:00, 6.94it/s]"
|
607 |
+
]
|
608 |
+
},
|
609 |
+
{
|
610 |
+
"name": "stdout",
|
611 |
+
"output_type": "stream",
|
612 |
+
"text": [
|
613 |
+
"Time taken for one batch, Art Adapter scale=1.0: 3.107145309448242\n",
|
614 |
+
"Running on local URL: http://127.0.0.1:7865\n",
|
615 |
+
"Running on public URL: https://26432817d4a57fa05b.gradio.live\n",
|
616 |
+
"\n",
|
617 |
+
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
|
618 |
+
]
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"data": {
|
622 |
+
"text/html": [
|
623 |
+
"<div><iframe src=\"https://26432817d4a57fa05b.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
624 |
+
],
|
625 |
+
"text/plain": [
|
626 |
+
"<IPython.core.display.HTML object>"
|
627 |
+
]
|
628 |
+
},
|
629 |
+
"metadata": {},
|
630 |
+
"output_type": "display_data"
|
631 |
+
},
|
632 |
+
{
|
633 |
+
"data": {
|
634 |
+
"text/plain": []
|
635 |
+
},
|
636 |
+
"execution_count": 22,
|
637 |
+
"metadata": {},
|
638 |
+
"output_type": "execute_result"
|
639 |
}
|
640 |
],
|
641 |
"source": [
|
|
|
725 |
" height=\"auto\",\n",
|
726 |
" scale=1,\n",
|
727 |
" )\n",
|
728 |
+
" start_timestep = gr.Slider(label=\"Timestep start from:\", minimum=0, maximum=1000, value=800, step=1)\n",
|
729 |
" with gr.Row():\n",
|
730 |
" btn_style_ori = gr.Button(\"Art-Free Stylize\", scale=1)\n",
|
731 |
" btn_style_art = gr.Button(\"Artistic Stylize\", scale=1)\n",
|
|
|
767 |
" examples = gr.Examples(\n",
|
768 |
" examples=[\n",
|
769 |
" [\"Snow-covered trees with sunlight shining through\",\n",
|
770 |
+
" \"data/Snow-covered_trees_with_sunlight_shining_through.jpg\",\n",
|
771 |
" ],\n",
|
772 |
" [\"A picturesque landscape showcasing a winding river cutting through a lush green valley, surrounded by rugged mountains under a clear blue sky. The mix of red and brown tones in the rocky hills adds to the region's natural beauty and diversity.\",\n",
|
773 |
+
" \"data/0011772.jpg\",\n",
|
774 |
+
" ],\n",
|
775 |
" [\"a black SUV driving down a highway with a scenic view of mountains and water in the background. The SUV is the main focus of the image, and it appears to be traveling at a moderate speed. The road is well-maintained and provides a smooth driving experience. The mountains and water create a picturesque backdrop, adding to the overall beauty of the scene. The image captures the essence of a leisurely road trip, with the SUV as the primary subject, highlighting the sense of adventure and exploration that comes with such journeys.\",\n",
|
776 |
+
" \"data/a_black_SUV_driving_down_a_highway_with_a_scenic_view_of_mountains_and_water_in_the_background._The_.jpg\",\n",
|
777 |
" ],\n",
|
778 |
" [\n",
|
779 |
" \"A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.\",\n",
|
780 |
+
" \"data/003904765.jpg\",\n",
|
781 |
" ]\n",
|
782 |
"\n",
|
783 |
" ],\n",
|
784 |
" inputs=[\n",
|
785 |
" text,\n",
|
786 |
+
" gallery_stylization_ref,\n",
|
787 |
+
" adapter_choice,\n",
|
788 |
+
" seed,\n",
|
789 |
+
" steps,\n",
|
790 |
+
" scale,\n",
|
791 |
+
" adapter_scale,\n",
|
792 |
+
" start_timestep, \n",
|
793 |
" ],\n",
|
794 |
+
" fn=demo_inference_all,\n",
|
795 |
+
" outputs=[gallery_gen_ori, gallery_gen_art, gallery_stylization_ori, gallery_stylization_art],\n",
|
796 |
+
" cache_examples=True,\n",
|
797 |
" )\n",
|
798 |
"block.launch(share=True)"
|
799 |
]
|