Skip to content
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 a method to add sample ids to a dataset #332

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions fuse/data/datasets/dataset_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ def get_all_sample_ids(self) -> List[Any]:
def set_final_sample_ids(self, final_sample_ids: List[Any]) -> None:
self._final_sample_ids = final_sample_ids

def add_sample_ids_and_recreate(
self, added_sample_ids: List[Any], **kwargs: Dict
) -> None:
self._orig_sample_ids = self._final_sample_ids + added_sample_ids
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to use self.get_all_sample_ids() instead of self._final_sample_ids :)

Copy link
Collaborator Author

@michalozeryflato michalozeryflato Aug 31, 2023

Choose a reason for hiding this comment

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

I think it is clearer to use _final_sample_ids, and it may be easier to track its use if the logic changes. Anyway, if you insist I will make your suggested change

self._created = False
self.create(**kwargs)

def __getitem__(self, item: Union[int, Hashable]) -> NDict:
"""
Get sample, read from cache if possible
Expand Down