FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[BREAKING][Feat] Support managing multiple data partitions for Train/Val/Test in controller by LLLLxmmm · Pull Request #98 · TransferQueue/TransferQueue · GitHub

This repository was archived by the owner on Jan 21, 2026. It is now read-only.

[BREAKING][Feat] Support managing multiple data partitions for Train/Val/Test in controller - #98

Merged
0oshowero0 merged 14 commits into
TransferQueue:devfrom
LLLLxmmm:lxm_controller_refactor
Nov 4, 2025
Merged

[BREAKING][Feat] Support managing multiple data partitions for Train/Val/Test in controller#98
0oshowero0 merged 14 commits into
TransferQueue:devfrom
LLLLxmmm:lxm_controller_refactor

Conversation

Copy link
Copy Markdown
Contributor

No description provided.

coderabbitai Bot commented Oct 31, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches 🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

return partition.generate_data_status_mask(field_names, task_name, sample_filter)

def _get_metadata(
def get_metadata(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not make get_metadata a private method?


def _scan_data_status(
self, data_fields: list[str], global_step: int, task_name: str, get_n_samples: bool
def scan_data_status(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not make scan_data_status a private method?


def _generate_batch_meta(
self, global_step: int, global_indexes: list[int], data_fields: list[str], mode: str
def generate_batch_meta(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not make generate_batch_meta a private method?

per_field_shapes[global_idx][field] = data_item.shape if hasattr(data_item, "shape") else None

# Get current data partition id
partition_id = metadata.samples[0].partition_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe we need to support put to & get from multiple partitions.
We can simply point out that currently we support only one partition and may consider supporting it in the future

Comment thread transfer_queue/client.py Outdated
metadata: Records the metadata of a batch of data samples, containing index and
storage unit information. If None, metadata will be auto-generated.
global_step: Current processing step (required if metadata is not provided)
partition_id: Current data partition id (required if metadata is not provided)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
partition_id: Current data partition id (required if metadata is not provided)
partition_id: Target data partition id (required if metadata is not provided)

Comment thread transfer_queue/client.py Outdated

if metadata is None:
assert global_step is not None, "global_steps must be provided if metadata is not given"
assert partition_id is not None, "partition_id must be provided if metadata is not given"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

better to raise an error. assert might be ignored

Comment thread transfer_queue/client.py Outdated

@dynamic_socket(socket_name="request_handle_socket")
async def check_current_step_consumption(self, task_name: str, global_step: int):
async def check_current_step_consumption(self, task_name: str, partition_id: str):

0oshowero0 Nov 3, 2025
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
async def check_current_step_consumption(self, task_name: str, partition_id: str):
async def check_data_consumption_status(self, task_name: str, partition_id: str):

Comment thread transfer_queue/client.py Outdated
@dynamic_socket(socket_name="request_handle_socket")
async def check_current_step_production(self, data_fields: list[str], global_step: int):
"""Check if all samples for current step are ready for consumption.
async def check_current_step_production(self, data_fields: list[str], partition_id: str):

0oshowero0 Nov 3, 2025
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
async def check_current_step_production(self, data_fields: list[str], partition_id: str):
async def check_data_production_status(self, data_fields: list[str], partition_id: str):

Comment thread transfer_queue/client.py Outdated
data: Data to write as TensorDict
metadata: Optional metadata containing index and storage unit information
global_step: Current processing step (required if metadata is not provided)
partition_id: Current data partition id (required if metadata is not provided)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
partition_id: Current data partition id (required if metadata is not provided)
partition_id: Target data partition id (required if metadata is not provided)

Comment thread transfer_queue/client.py Outdated
data_fields: List of data field names to retrieve metadata for
batch_size: Number of samples to request in the batch
global_step: Current training/processing step
partition_id: Current data partition id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
partition_id: Current data partition id
partition_id: Target data partition

Comment thread transfer_queue/controller.py Outdated
TQ_FIELD_MIN_EXPANSION_SIZE = int(
os.environ.get("TQ_FIELD_MIN_EXPANSION_SIZE", 5)
) # Minimum expansion size for fields (columns)
TQ_INIT_SAMPLE_NUM = int(os.environ.get("TQ_INIT_SAMPLE_NUM", 10)) # Initial number of samples

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Put this near TQ_INIT_FIELD_NUM ~

Comment thread transfer_queue/controller.py Outdated
Comment on lines +107 to +108
for idx in indexes:
self.allocated_indexes.discard(idx)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why allocated_indexes is tracking reusable_indexes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

maybe we can just release them during release_indexes

indexes = []

# Get indexes from reusable pool
if self.reusable_indexes and count > 0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

need to tackle count <=0 by rasing an error

Comment thread transfer_queue/controller.py Outdated
Comment on lines +116 to +126
while len(new_indexes) < needed:
# Check if current counter points to an already used index
if self.global_index_counter not in self.allocated_indexes:
new_indexes.append(self.global_index_counter)
self.allocated_indexes.add(self.global_index_counter)
self.global_index_counter += 1
else:
# If already used, increment counter until finding available index
self.global_index_counter += 1

indexes.extend(new_indexes)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

can be optimized. using while loop and append list is slow

Comment thread transfer_queue/controller.py Outdated
Comment on lines +149 to +150
# Add released indexes to allocated_indexes set
self.allocated_indexes.update(indexes)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why?

Comment thread transfer_queue/controller.py Outdated
"""
return self.partition_to_indexes.get(partition_id, set()).copy()

def get_allocated_indexes(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If not used, we can simply delete this func

Comment thread transfer_queue/controller.py Outdated

# Field metadata
field_name_mapping: dict[str, int] = field(default_factory=dict) # field_name -> column_index
field_dtypes: dict[int, dict[str, Any]] = field(default_factory=dict) # sample_idx -> {field: dtype}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

sample_idx -> global_idx?

Comment thread transfer_queue/controller.py Outdated
return len(self.field_name_mapping)

@property
def allocated_fields(self) -> int:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if not used we can delete this func

Comment thread transfer_queue/controller.py Outdated
return self.production_status.shape[0] if self.production_status is not None else 0

@property
def total_fields(self) -> int:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
def total_fields(self) -> int:
def total_fields_num(self) -> int:

Comment thread transfer_queue/controller.py Outdated

# Dynamic configuration - these are computed from the current state
@property
def total_samples(self) -> int:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
def total_samples(self) -> int:
def total_samples_num(self) -> int:

Returns:
True if expansion was successful or not needed, False on error
"""
if self.production_status is None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

better do this during init process

required_samples: Minimum number of samples needed

Returns:
True if expansion was successful or not needed, False on error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

we don't need a return value. same for field expansion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

add TODO

Comment thread transfer_queue/controller.py Outdated
num_n_samples: int = 1,
) -> None:
"""Initialize the TransferQueueController.
sample_indices: list[int],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
sample_indices: list[int],
global_indices: list[int],

"""Initialize the TransferQueueController.
sample_indices: list[int],
field_names: list[str],
dtypes: Optional[dict[int, dict[str, Any]]] = None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

the d type and shape will be always required

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

because many storage backends need these info to speed up transport

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

add TODO

Comment thread transfer_queue/controller.py Outdated
Comment on lines +405 to +410
# Ensure consumption tensor has same number of rows as production tensor
consumption_tensor = self.consumption_status[task_name]
if self.production_status is not None and consumption_tensor.shape[0] < self.total_samples:
expanded_consumption = torch.zeros(self.total_samples, dtype=torch.int8)
expanded_consumption[: consumption_tensor.shape[0]] = consumption_tensor
self.consumption_status[task_name] = expanded_consumption

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

extend consumption status should not be here (in get_consumption_status)? When we update data status, we should extend the consumption status as well

sample_indices: List of sample indices to mark as consumed

Returns:
True if successful, False on error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just raise an error. same for other functions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

add TODO

Comment thread transfer_queue/controller.py Outdated

# ==================== Data Scanning and Query Methods ====================

def scan_data_status(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

When merge with Sampler design, maybe we can just pass the production_status and consumption_status to the Sampler.sample function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

need more thinking here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

暂时不用改

Comment thread transfer_queue/controller.py Outdated
return []

# Create row mask
if sample_filter is not None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if it is not necessary, we can delete it

Comment thread transfer_queue/controller.py Outdated

return ready_sample_indices

def generate_data_status_mask(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if it is not necessary, we can delete it

logger.error(f"Error updating production status for partition {self.partition_id}: {e}")
return False

def _update_field_metadata(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

need to optimize. Now it will be very slow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

add TODO

0oshowero0 changed the title Support managing multiple data partitions for Train/Val/Test in controller [BREAKING] Support managing multiple data partitions for Train/Val/Test in controller Nov 4, 2025
0oshowero0 changed the title [BREAKING] Support managing multiple data partitions for Train/Val/Test in controller [BREAKING][Feat] Support managing multiple data partitions for Train/Val/Test in controller Nov 4, 2025
0oshowero0 merged commit 445edb4 into TransferQueue:dev Nov 4, 2025
3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL