Skip to content

Commit

Permalink
Quick fix for some minor problems (#503)
Browse files Browse the repository at this point in the history
* * 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
  • Loading branch information
HYLcool authored Dec 3, 2024
1 parent 6766316 commit 4ab426e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
unittest-single:
runs-on: [self-hosted, linux, unittest]
runs-on: [GPU, unittest]
environment: Testing
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 2 additions & 4 deletions data_juicer/utils/mm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ def cut_video_by_seconds(
input_video_stream = container.streams.video[0]
codec_name = input_video_stream.codec_context.name
fps = input_video_stream.base_rate
output_video_stream = output_container.add_stream(codec_name,
rate=str(fps))
output_video_stream = output_container.add_stream(codec_name, rate=fps)
output_video_stream.width = input_video_stream.codec_context.width
output_video_stream.height = input_video_stream.codec_context.height
output_video_stream.pix_fmt = input_video_stream.codec_context.pix_fmt
Expand Down Expand Up @@ -431,8 +430,7 @@ def process_each_frame(input_video: Union[str, av.container.InputContainer],

codec_name = input_video_stream.codec_context.name
fps = input_video_stream.base_rate
output_video_stream = output_container.add_stream(codec_name,
rate=str(fps))
output_video_stream = output_container.add_stream(codec_name, rate=fps)
output_video_stream.pix_fmt = input_video_stream.codec_context.pix_fmt
output_video_stream.width = input_video_stream.codec_context.width
output_video_stream.height = input_video_stream.codec_context.height
Expand Down
6 changes: 4 additions & 2 deletions tests/ops/filter/test_audio_duration_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

from data_juicer.ops.filter.audio_duration_filter import AudioDurationFilter
from data_juicer.utils.constant import Fields
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, TEST_TAG

from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, TEST_TAG, SKIPPED_TESTS

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

data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
Expand Down
6 changes: 4 additions & 2 deletions tests/ops/filter/test_audio_nmf_snr_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

from data_juicer.ops.filter.audio_nmf_snr_filter import AudioNMFSNRFilter
from data_juicer.utils.constant import Fields
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase

from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS

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

data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
Expand Down
6 changes: 4 additions & 2 deletions tests/ops/filter/test_video_motion_score_raft_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from data_juicer.ops.filter.video_motion_score_raft_filter import \
VideoMotionScoreRaftFilter
from data_juicer.utils.constant import Fields
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase

from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS

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

data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
Expand Down
2 changes: 1 addition & 1 deletion tests/ops/filter/test_video_tagging_from_frames_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from data_juicer.ops.filter.video_tagging_from_frames_filter import \
VideoTaggingFromFramesFilter
from data_juicer.utils.mm_utils import SpecialTokens
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase

class VideoTaggingFromFramesFilterTest(DataJuicerTestCaseBase):
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
Expand Down
5 changes: 4 additions & 1 deletion tests/ops/mapper/test_video_tagging_from_audio_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
VideoTaggingFromAudioMapper
from data_juicer.utils.constant import Fields
from data_juicer.utils.mm_utils import SpecialTokens
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase
from data_juicer.utils.unittest_utils import DataJuicerTestCaseBase, SKIPPED_TESTS

# skip due to conflicts when run lazy_load in multiprocessing in librosa
# tests passed locally.
@SKIPPED_TESTS.register_module()
class VideoTaggingFromAudioMapperTest(DataJuicerTestCaseBase):
data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
'data')
Expand Down

0 comments on commit 4ab426e

Please sign in to comment.