-
Notifications
You must be signed in to change notification settings - Fork 320
Revert "Remove nvenc/dec for xenna 0.1.6" #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eff0f32
84c4235
585c424
8ca7ecf
fb91b2d
4066315
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,13 @@ | |
| from dataclasses import dataclass | ||
| from typing import Any | ||
|
|
||
| from cosmos_xenna.ray_utils.resources import _get_local_gpu_info, _make_gpu_resources_from_gpu_name | ||
| from loguru import logger | ||
|
|
||
| from nemo_curator.backends.base import WorkerMetadata | ||
| from nemo_curator.backends.experimental.utils import RayStageSpecKeys | ||
| from nemo_curator.stages.base import ProcessingStage | ||
| from nemo_curator.stages.resources import Resources | ||
| from nemo_curator.stages.resources import Resources, _get_gpu_memory_gb | ||
| from nemo_curator.tasks.video import Clip, Video, VideoTask | ||
| from nemo_curator.utils import grouping | ||
| from nemo_curator.utils.operation_utils import make_pipeline_temporary_dir | ||
|
|
@@ -78,7 +79,12 @@ def __post_init__(self) -> None: | |
| if self.encoder == "h264_nvenc" or self.use_hwaccel: | ||
| if self.nb_streams_per_gpu > 0: | ||
| # Assume that we have same type of GPUs | ||
| self.resources = Resources(gpus=1.0 / self.nb_streams_per_gpu) | ||
| gpu_info = _get_local_gpu_info()[0] | ||
| nvencs = _make_gpu_resources_from_gpu_name(gpu_info.name).num_nvencs | ||
| gpu_memory_gb = _get_gpu_memory_gb() | ||
| self.resources = Resources( | ||
| nvencs=nvencs // self.nb_streams_per_gpu, gpu_memory_gb=gpu_memory_gb // self.nb_streams_per_gpu | ||
| ) | ||
|
Comment on lines
+86
to
+87
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Integer division by |
||
| else: | ||
| self.resources = Resources(gpus=1) | ||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,13 @@ def __init__(self, index: int, name: str): | |
| self.name = name | ||
|
|
||
|
|
||
| # Mock GPU resources class to simulate GPU resources | ||
| class MockGpuResources: | ||
| def __init__(self, num_nvencs: int = 3, num_nvdecs: int = 3): | ||
| self.num_nvencs = num_nvencs | ||
| self.num_nvdecs = num_nvdecs | ||
|
|
||
|
Comment on lines
+37
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: |
||
|
|
||
| class TestClipTranscodingStage: | ||
| """Test cases for ClipTranscodingStage.""" | ||
|
|
||
|
|
@@ -273,28 +280,6 @@ def test_add_hwaccel_options_disabled(self) -> None: | |
| # Should not add any hwaccel options | ||
| assert "-hwaccel" not in command | ||
|
|
||
| def test_add_hwaccel_options_enabled(self) -> None: | ||
| """Test hardware acceleration options when enabled.""" | ||
| command = [] | ||
| stage = ClipTranscodingStage(use_hwaccel=True, encoder="h264_nvenc", nb_streams_per_gpu=1) | ||
|
|
||
| stage._add_hwaccel_options(command) | ||
|
|
||
| assert "-hwaccel" in command | ||
| assert "-hwaccel_output_format" in command | ||
| assert stage.resources.gpus == 1.0 | ||
|
|
||
| def test_add_hwaccel_options_enabled_multiple_streams(self) -> None: | ||
| """Test hardware acceleration options when enabled.""" | ||
| command = [] | ||
| stage = ClipTranscodingStage(use_hwaccel=True, encoder="h264_nvenc", nb_streams_per_gpu=4) | ||
|
|
||
| stage._add_hwaccel_options(command) | ||
|
|
||
| assert "-hwaccel" in command | ||
| assert "-hwaccel_output_format" in command | ||
| assert stage.resources.gpus == 0.25 | ||
|
|
||
| def test_add_input_options(self) -> None: | ||
| """Test adding input options to FFmpeg command.""" | ||
| command = [] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Accessing
[0]assumes at least one GPU is available. This will raise an IndexError if no GPUs are detected. Should this handle the case where no GPUs are available or add validation?