JingsongLi commented on code in PR #11059:
URL: https://github.com/apache/paimon/pull/11059#discussion_r4520851336


##########
paimon-python/pypaimon/multimodal/lerobot/dataset.py:
##########
@@ -532,9 +532,14 @@ def _get_items(self, indices, return_batch, share_memory):
                 if key in visual_windows:
                     item[key] = visual_windows[key][offset]
                 else:
-                    item[key] = torch.stack([
-                        converted[position][key] for position in positions
-                    ])
+                    values = [converted[position][key] for position in 
positions]
+                    if key == "subtask_index" and _contains_none(values):
+                        item[key] = [
+                            value.clone() if torch.is_tensor(value) else value

Review Comment:
   **[P2] Avoid one tensor storage per label in nullable DataLoader windows**
   
   This branch clones each non-null label into its own scalar tensor, and the 
nullable collator sends those tensors through worker IPC without stacking them. 
With one worker, a batch size of 64, 32 frames per window, and one null label 
every 16 frames, I measured 1,920 distinct `subtask_index` storages on macOS, 
compared with one for a fully labeled batch. [PyTorch's default Linux sharing 
strategy](https://docs.pytorch.org/docs/2.9/multiprocessing.html#file-descriptor-file-descriptor)
 holds one file descriptor per shared storage, so a single batch can exhaust a 
process's 1,024-descriptor soft limit. Could we pack the non-null indices into 
one shared tensor and use views for the individual entries while preserving the 
`None` positions?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to