-
Notifications
You must be signed in to change notification settings - Fork 8
Feat/text to image eval primitives: add prompt-driven evaluation primitives (PromptDataset + CLIPScore + Recall@K + MRR) #1284
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
base: main
Are you sure you want to change the base?
Changes from all commits
d726e14
d0d9c6a
b97b07b
6fba49f
253a2a7
f191b86
db4329a
daf8a47
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 |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| from .mask_generation import MaskGenerationDataset | ||
| from .object_detection import DEFAULT_OBJECT_DETECTION_SIZE, ObjectDetectionDataset | ||
| from .processor_utils import get_image_processor_config | ||
| from .prompt_dataset import PromptDataset, PromptRecord | ||
|
Member
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. Could we wire these primitives into the evaluator flow in this PR? |
||
| from .random_dataset import RandomDataset | ||
| from .text import TextDataset | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,10 @@ class BaseTaskDataset(ABC): | |
| properties are readonly to ensure dataset immutability and thread safety. | ||
|
|
||
| Attributes: | ||
| model_name: HuggingFace model identifier or local model path | ||
| model_name: HuggingFace model identifier or local model path. | ||
| Optional — task-agnostic data sources (e.g. prompt corpora used | ||
| by generative-model evaluators) may leave this ``None``. Most | ||
| calibration and task-oriented subclasses require it. | ||
| dataset_name: Dataset identifier (HF dataset or local path) | ||
| data_split: Dataset split to use (e.g., 'train', 'validation', 'test') | ||
| """ | ||
|
|
@@ -35,7 +38,7 @@ class BaseTaskDataset(ABC): | |
|
|
||
| def __init__( | ||
| self, | ||
|
Member
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. Should |
||
| model_name: str, | ||
| model_name: str | None = None, | ||
| dataset_name: str | None = None, | ||
| max_samples: int | None = None, | ||
| data_split: str | None = None, | ||
|
|
@@ -44,7 +47,10 @@ def __init__( | |
| """Initialize dataset with readonly properties. | ||
|
|
||
| Args: | ||
| model_name: HuggingFace model identifier or path | ||
| model_name: HuggingFace model identifier or path. Optional — | ||
| task-agnostic subclasses may pass ``None``. Task-oriented | ||
| subclasses that need a tokenizer/processor should validate | ||
| its presence themselves. | ||
| dataset_name: Dataset name (uses DEFAULT_DATASET if None) | ||
| max_samples: Maximum number of samples (None = use all) | ||
| data_split: Dataset split (None = let subclass decide) | ||
|
|
@@ -78,8 +84,12 @@ def _initialize(self) -> None: | |
|
|
||
| # Readonly properties | ||
| @property | ||
| def model_name(self) -> str: | ||
| """Get the model name (readonly).""" | ||
| def model_name(self) -> str | None: | ||
| """Get the model name (readonly). | ||
|
|
||
| ``None`` for task-agnostic subclasses that are not bound to a | ||
| specific model. | ||
| """ | ||
| return self._model_name | ||
|
|
||
| @property | ||
|
|
@@ -92,7 +102,6 @@ def data_split(self) -> str | None: | |
| """Get the dataset split (readonly).""" | ||
| return self._data_split | ||
|
|
||
|
|
||
| def __len__(self) -> int: | ||
| """Return the number of samples in the dataset.""" | ||
| if self._dataset is None: | ||
|
|
||
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.
Since these are being exposed from the package root, please also add
PromptDatasetandPromptRecordto__all__below. Otherwisefrom winml.modelkit.datasets import *and code/docs that rely on the declared public API won't include the new prompt dataset primitives, unlike the other dataset classes exported here.