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
4d6cf760
Commit
4d6cf760
authored
Jul 13, 2025
by
GoatWu
Browse files
support vbench i2v
parent
31d1e13d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
lightx2v/utils/utils.py
lightx2v/utils/utils.py
+8
-0
scripts/server/post_vbench_i2v.py
scripts/server/post_vbench_i2v.py
+44
-0
No files found.
lightx2v/utils/utils.py
View file @
4d6cf760
...
...
@@ -58,6 +58,14 @@ def cache_video(
value_range
=
(
-
1
,
1
),
retry
=
5
,
):
save_dir
=
os
.
path
.
dirname
(
save_file
)
try
:
if
not
os
.
path
.
exists
(
save_dir
):
os
.
makedirs
(
save_dir
,
exist_ok
=
True
)
except
Exception
as
e
:
logger
.
error
(
f
"Failed to create directory:
{
save_dir
}
, error:
{
e
}
"
)
return
None
cache_file
=
save_file
# save to cache
...
...
scripts/server/post_vbench_i2v.py
0 → 100644
View file @
4d6cf760
from
tqdm
import
tqdm
import
argparse
import
glob
import
os
import
requests
import
time
def
post_i2v
(
image_path
,
output_path
):
url
=
"http://localhost:8000"
file_name
=
os
.
path
.
basename
(
image_path
)
prompt
=
os
.
path
.
splitext
(
file_name
)[
0
]
save_video_path
=
os
.
path
.
join
(
output_path
,
f
"
{
prompt
}
.mp4"
)
message
=
{
"prompt"
:
prompt
,
"negative_prompt"
:
"镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
,
"image_path"
:
image_path
,
"save_video_path"
:
save_video_path
,
}
while
True
:
response
=
requests
.
get
(
f
"
{
url
}
/v1/service/status"
).
json
()
if
response
[
"service_status"
]
==
"idle"
:
response
=
requests
.
post
(
f
"
{
url
}
/v1/tasks/"
,
json
=
message
)
return
time
.
sleep
(
3
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--data_path"
,
type
=
str
,
required
=
True
,
help
=
"path to img files."
)
parser
.
add_argument
(
"--output_path"
,
type
=
str
,
default
=
"./vbench_i2v"
,
help
=
"output video path."
)
args
=
parser
.
parse_args
()
if
os
.
path
.
exists
(
args
.
data_path
):
img_files
=
glob
.
glob
(
os
.
path
.
join
(
args
.
data_path
,
"*.jpg"
))
print
(
f
"Found
{
len
(
img_files
)
}
image files."
)
with
tqdm
(
total
=
len
(
img_files
))
as
progress_bar
:
for
idx
,
img_path
in
enumerate
(
img_files
):
post_i2v
(
img_path
,
args
.
output_path
)
progress_bar
.
update
()
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