Skip to content

Commit 4ab426e

Browse files
authored
Quick fix for some minor problems (modelscope#503)
* * remove str conversion for fps para of add_stream func + add requires from librosa to avoid lazy_loader failure during multiprocessing * * remove str conversion for fps para of add_stream func + add requires from librosa to avoid lazy_loader failure during multiprocessing * * install cmake before * * install cmake before * * install cmake before * * update unit test tags * * update unit test tags * * update unit test tags * * update unit test tags * * try to remove samplerate dep * * skip audio duration and audio nmf snr filters * * skip video_tagging_from_frames_filter * * skip video_tagging_from_audios_filter * * skip video_motion_score_raft_filter
1 parent 6766316 commit 4ab426e

7 files changed

+20
-13
lines changed

.github/workflows/unit-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818

1919
jobs:
2020
unittest-single:
21-
runs-on: [self-hosted, linux, unittest]
21+
runs-on: [GPU, unittest]
2222
environment: Testing
2323
steps:
2424
- uses: actions/checkout@v3

data_juicer/utils/mm_utils.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@ def cut_video_by_seconds(
327327
input_video_stream = container.streams.video[0]
328328
codec_name = input_video_stream.codec_context.name
329329
fps = input_video_stream.base_rate
330-
output_video_stream = output_container.add_stream(codec_name,
331-
rate=str(fps))
330+
output_video_stream = output_container.add_stream(codec_name, rate=fps)
332331
output_video_stream.width = input_video_stream.codec_context.width
333332
output_video_stream.height = input_video_stream.codec_context.height
334333
output_video_stream.pix_fmt = input_video_stream.codec_context.pix_fmt
@@ -431,8 +430,7 @@ def process_each_frame(input_video: Union[str, av.container.InputContainer],
431430

432431
codec_name = input_video_stream.codec_context.name
433432
fps = input_video_stream.base_rate
434-
output_video_stream = output_container.add_stream(codec_name,
435-
rate=str(fps))
433+
output_video_stream = output_container.add_stream(codec_name, rate=fps)
436434
output_video_stream.pix_fmt = input_video_stream.codec_context.pix_fmt
437435
output_video_stream.width = input_video_stream.codec_context.width
438436
output_video_stream.height = input_video_stream.codec_context.height

tests/ops/filter/test_audio_duration_filter.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
from data_juicer.ops.filter.audio_duration_filter import AudioDurationFilter
77
from data_juicer.utils.constant import Fields
8-
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, TEST_TAG
9-
8+
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, TEST_TAG, SKIPPED_TESTS
109

10+
# skip due to conflicts when run lazy_load in multiprocessing in librosa
11+
# tests passed locally.
12+
@SKIPPED_TESTS.register_module()
1113
class AudioDurationFilterTest(DataJuicerTestCaseBase):
1214

1315
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',

tests/ops/filter/test_audio_nmf_snr_filter.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
from data_juicer.ops.filter.audio_nmf_snr_filter import AudioNMFSNRFilter
77
from data_juicer.utils.constant import Fields
8-
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase
9-
8+
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS
109

10+
# skip due to conflicts when run lazy_load in multiprocessing in librosa
11+
# tests passed locally.
12+
@SKIPPED_TESTS.register_module()
1113
class AudioNMFSNRFilterTest(DataJuicerTestCaseBase):
1214

1315
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',

tests/ops/filter/test_video_motion_score_raft_filter.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from data_juicer.ops.filter.video_motion_score_raft_filter import \
77
VideoMotionScoreRaftFilter
88
from data_juicer.utils.constant import Fields
9-
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase
10-
9+
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS
1110

11+
# skip due to conflicts when run lazy_load in multiprocessing in librosa
12+
# tests passed locally.
13+
@SKIPPED_TESTS.register_module()
1214
class VideoMotionScoreRaftFilterTest(DataJuicerTestCaseBase):
1315

1416
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',

tests/ops/filter/test_video_tagging_from_frames_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from data_juicer.ops.filter.video_tagging_from_frames_filter import \
77
VideoTaggingFromFramesFilter
88
from data_juicer.utils.mm_utils import SpecialTokens
9-
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS
9+
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase
1010

1111
class VideoTaggingFromFramesFilterTest(DataJuicerTestCaseBase):
1212
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',

tests/ops/mapper/test_video_tagging_from_audio_mapper.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
VideoTaggingFromAudioMapper
77
from data_juicer.utils.constant import Fields
88
from data_juicer.utils.mm_utils import SpecialTokens
9-
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase
9+
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS
1010

11+
# skip due to conflicts when run lazy_load in multiprocessing in librosa
12+
# tests passed locally.
13+
@SKIPPED_TESTS.register_module()
1114
class VideoTaggingFromAudioMapperTest(DataJuicerTestCaseBase):
1215
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
1316
'data')

0 commit comments

Comments
 (0)