-
Notifications
You must be signed in to change notification settings - Fork 320
Add ray data for image #1610
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
Add ray data for image #1610
Changes from all commits
6709ba0
ae3bf46
6a462de
1c2df7e
688fe85
590d503
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,11 +15,13 @@ | |||||||||||||
| import pathlib | ||||||||||||||
| from collections.abc import Generator | ||||||||||||||
| from dataclasses import dataclass | ||||||||||||||
| from typing import Any | ||||||||||||||
|
|
||||||||||||||
| import numpy as np | ||||||||||||||
| import torch | ||||||||||||||
| from loguru import logger | ||||||||||||||
|
|
||||||||||||||
| 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.tasks import FileGroupTask, ImageBatch, ImageObject | ||||||||||||||
|
|
@@ -51,6 +53,12 @@ def __post_init__(self) -> None: | |||||||||||||
| else: | ||||||||||||||
| self.resources = Resources() | ||||||||||||||
|
|
||||||||||||||
| def ray_stage_spec(self) -> dict[str, Any]: | ||||||||||||||
| """Ray stage specification for this stage.""" | ||||||||||||||
| return { | ||||||||||||||
| RayStageSpecKeys.IS_FANOUT_STAGE: True, | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| def inputs(self) -> tuple[list[str], list[str]]: | ||||||||||||||
| return [], [] | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -98,11 +106,7 @@ def _read_tars_with_dali(self, tar_paths: list[pathlib.Path]) -> Generator[list[ | |||||||||||||
| # Use the tar filename stem as the id prefix for single shards; for grouped shards, | ||||||||||||||
| # synthesize a group prefix and place generated image paths under the tars' parent dir. | ||||||||||||||
| base_path = tar_paths[0] if len(tar_paths) == 1 else tar_paths[0].parent | ||||||||||||||
| id_prefix = ( | ||||||||||||||
| tar_paths[0].stem | ||||||||||||||
| if len(tar_paths) == 1 | ||||||||||||||
| else f"group_{tar_paths[0].stem}_x{len(tar_paths)}" | ||||||||||||||
| ) | ||||||||||||||
| id_prefix = tar_paths[0].stem if len(tar_paths) == 1 else f"group_{tar_paths[0].stem}_x{len(tar_paths)}" | ||||||||||||||
|
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. The original multi-line ternary was reformatted into a single ~105-character line. This makes the line harder to scan and likely exceeds the project's line-length limit. The original multi-line form was clearer — consider reverting to it:
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||
|
|
||||||||||||||
| while samples_completed < total_samples: | ||||||||||||||
| img_batch = pipe.run() | ||||||||||||||
|
|
||||||||||||||
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.
This makes sense, thanks for adding it .