Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xuwx1
LightX2V
Commits
57cd9bc2
Commit
57cd9bc2
authored
Jul 16, 2025
by
gaclove
Browse files
Refactor async calls to synchronous in inference scripts
parent
5103aef7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
8 deletions
+5
-8
app/gradio_demo.py
app/gradio_demo.py
+1
-2
app/gradio_demo_zh.py
app/gradio_demo_zh.py
+1
-2
lightx2v/infer.py
lightx2v/infer.py
+3
-4
No files found.
app/gradio_demo.py
View file @
57cd9bc2
import
os
import
gradio
as
gr
import
asyncio
import
argparse
import
json
import
torch
...
...
@@ -449,7 +448,7 @@ def run_inference(
else
:
runner
.
config
=
config
asyncio
.
run
(
runner
.
run_pipeline
()
)
runner
.
run_pipeline
()
del
config
,
args
,
model_config
,
quant_model_config
if
"dit_quantized_ckpt"
in
locals
():
...
...
app/gradio_demo_zh.py
View file @
57cd9bc2
import
os
import
gradio
as
gr
import
asyncio
import
argparse
import
json
import
torch
...
...
@@ -451,7 +450,7 @@ def run_inference(
else
:
runner
.
config
=
config
asyncio
.
run
(
runner
.
run_pipeline
()
)
runner
.
run_pipeline
()
del
config
,
args
,
model_config
,
quant_model_config
if
"dit_quantized_ckpt"
in
locals
():
...
...
lightx2v/infer.py
View file @
57cd9bc2
import
asyncio
import
argparse
import
torch
import
torch.distributed
as
dist
...
...
@@ -40,7 +39,7 @@ def init_runner(config):
return
runner
async
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--model_cls"
,
type
=
str
,
required
=
True
,
choices
=
[
"wan2.1"
,
"hunyuan"
,
"wan2.1_distill"
,
"wan2.1_causvid"
,
"wan2.1_skyreels_v2_df"
,
"cogvideox"
,
"wan2.1_audio"
],
default
=
"hunyuan"
...
...
@@ -85,8 +84,8 @@ async def main():
logger
.
info
(
f
"config:
\n
{
json
.
dumps
(
config
,
ensure_ascii
=
False
,
indent
=
4
)
}
"
)
runner
=
init_runner
(
config
)
await
runner
.
run_pipeline
()
runner
.
run_pipeline
()
if
__name__
==
"__main__"
:
asyncio
.
run
(
main
()
)
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment