Commit
·
ceb365c
1
Parent(s):
e7cf985
added --res --teacache --skip-guidance args
Browse files- gradio_server.py +26 -4
gradio_server.py
CHANGED
|
@@ -219,6 +219,27 @@ def _parse_args():
|
|
| 219 |
help="vae config mode"
|
| 220 |
)
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
args = parser.parse_args()
|
| 224 |
|
|
@@ -331,7 +352,7 @@ else:
|
|
| 331 |
root_lora_dir = lora_dir
|
| 332 |
lora_dir = get_lora_dir(root_lora_dir)
|
| 333 |
lora_preselected_preset = args.lora_preset
|
| 334 |
-
default_tea_cache =
|
| 335 |
# if args.fast : #or args.fastest
|
| 336 |
# transformer_filename_t2v = transformer_choices_t2v[2]
|
| 337 |
# attention_mode="sage2" if "sage2" in attention_modes_supported else "sage"
|
|
@@ -1825,6 +1846,7 @@ def create_demo():
|
|
| 1825 |
state = gr.State(state_dict)
|
| 1826 |
|
| 1827 |
with gr.Row():
|
|
|
|
| 1828 |
if use_image2video:
|
| 1829 |
resolution = gr.Dropdown(
|
| 1830 |
choices=[
|
|
@@ -1832,7 +1854,7 @@ def create_demo():
|
|
| 1832 |
("720p", "1280x720"),
|
| 1833 |
("480p", "832x480"),
|
| 1834 |
],
|
| 1835 |
-
value="832x480",
|
| 1836 |
label="Resolution (video will have the same height / width ratio than the original image)"
|
| 1837 |
)
|
| 1838 |
|
|
@@ -1853,7 +1875,7 @@ def create_demo():
|
|
| 1853 |
# ("624x832 (3:4, 540p)", "624x832"),
|
| 1854 |
# ("720x720 (1:1, 540p)", "720x720"),
|
| 1855 |
],
|
| 1856 |
-
value="832x480",
|
| 1857 |
label="Resolution"
|
| 1858 |
)
|
| 1859 |
|
|
@@ -1940,7 +1962,7 @@ def create_demo():
|
|
| 1940 |
("OFF", 0),
|
| 1941 |
("ON", 1),
|
| 1942 |
],
|
| 1943 |
-
value= 0,
|
| 1944 |
visible=True,
|
| 1945 |
scale = 1,
|
| 1946 |
label="Skip Layer guidance"
|
|
|
|
| 219 |
help="vae config mode"
|
| 220 |
)
|
| 221 |
|
| 222 |
+
parser.add_argument(
|
| 223 |
+
"--res",
|
| 224 |
+
type=str,
|
| 225 |
+
default="480p",
|
| 226 |
+
choices=["480p", "720p", "823p", "1024p", "1280p"],
|
| 227 |
+
help="Default resolution for the video (480p, 720p, 823p, 1024p or 1280p)"
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
+
parser.add_argument(
|
| 231 |
+
"--teacache",
|
| 232 |
+
type=str,
|
| 233 |
+
default="0",
|
| 234 |
+
choices=["0", "1.5", "1.75", "2.0", "2.25", "2.5"],
|
| 235 |
+
help="Default teacache setting"
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
+
parser.add_argument(
|
| 239 |
+
"--skip-guidance",
|
| 240 |
+
action="store_true",
|
| 241 |
+
help="Enable skip guidance"
|
| 242 |
+
)
|
| 243 |
|
| 244 |
args = parser.parse_args()
|
| 245 |
|
|
|
|
| 352 |
root_lora_dir = lora_dir
|
| 353 |
lora_dir = get_lora_dir(root_lora_dir)
|
| 354 |
lora_preselected_preset = args.lora_preset
|
| 355 |
+
default_tea_cache = float(args.teacache)
|
| 356 |
# if args.fast : #or args.fastest
|
| 357 |
# transformer_filename_t2v = transformer_choices_t2v[2]
|
| 358 |
# attention_mode="sage2" if "sage2" in attention_modes_supported else "sage"
|
|
|
|
| 1846 |
state = gr.State(state_dict)
|
| 1847 |
|
| 1848 |
with gr.Row():
|
| 1849 |
+
res = args.res
|
| 1850 |
if use_image2video:
|
| 1851 |
resolution = gr.Dropdown(
|
| 1852 |
choices=[
|
|
|
|
| 1854 |
("720p", "1280x720"),
|
| 1855 |
("480p", "832x480"),
|
| 1856 |
],
|
| 1857 |
+
value="1280x720" if res == "720p" else "832x480",
|
| 1858 |
label="Resolution (video will have the same height / width ratio than the original image)"
|
| 1859 |
)
|
| 1860 |
|
|
|
|
| 1875 |
# ("624x832 (3:4, 540p)", "624x832"),
|
| 1876 |
# ("720x720 (1:1, 540p)", "720x720"),
|
| 1877 |
],
|
| 1878 |
+
value={"480p": "832x480","720p": "1280x720","823p": "480x832","1024p": "1024x1024","1280p": "720x1280",}.get(res, "832x480"),
|
| 1879 |
label="Resolution"
|
| 1880 |
)
|
| 1881 |
|
|
|
|
| 1962 |
("OFF", 0),
|
| 1963 |
("ON", 1),
|
| 1964 |
],
|
| 1965 |
+
value= 1 if args.skip_guidance else 0,
|
| 1966 |
visible=True,
|
| 1967 |
scale = 1,
|
| 1968 |
label="Skip Layer guidance"
|