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

Refacto/Updated format of Harness #706

Merged
merged 35 commits into from
Aug 17, 2023
Merged

Conversation

Prikshit7766
Copy link
Contributor

@Prikshit7766 Prikshit7766 commented Aug 14, 2023

Description

Updated format of Harness

one model

harness = Harness(
            task = "text-classification",
            model={"model": "textcat_imdb", "hub": "spacy"},
            data={
            "data_source" : "glue",
            "subset": "sst2",
            "feature_column": "sentence",
            "target_column": "label",
            "split": "train",
            "source": "huggingface"
            }
        )

multiple model

Harness(
task="ner",
model=[{"model": "bert-base-cased", "hub": "huggingface"},
 {"model": "dslim/bert-base-NER", "hub": "huggingface"}],
data={
"data_source" : "/content/langtest/tests/fixtures/tner.csv"
}
)

where

  • model (list | dict, optional): Specifies the model to be evaluated.
    If provided as a list, each element should be a dictionary with 'model' and 'hub' keys.
    If provided as a dictionary, it must contain 'model' and 'hub' keys when specifying a path.

  • data (dict, optional): The data to be used for evaluation.
    The data parameter should be updated to accept a dictionary, providing more flexibility and options for data sources. The dictionary should include the following keys:

data_source (mandatory): The source of the data.
subset (optional): The subset of the data.
feature_column (optional): The column containing the features.
target_column (optional): The column containing the target labels.
split (optional): The data split to be used.


Fixes #581

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Usage

Checklist:

  • I've added Google style docstrings to my code.
  • I've used pydantic for typing when/where necessary.
  • I have linted my code
  • I have added tests to cover my changes.

@Prikshit7766 Prikshit7766 added the v2.1.0 Issue or request to be done in v2.1.0 release label Aug 14, 2023
@Prikshit7766 Prikshit7766 linked an issue Aug 14, 2023 that may be closed by this pull request
@Prikshit7766 Prikshit7766 changed the base branch from main to release/1.3.0 August 14, 2023 06:23
task (str): Task to be evaluated.
"""
self._file_path = file_path
self._file_path = file_path.get("data_source")
Copy link
Collaborator

Choose a reason for hiding this comment

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

if data_source is not provided, then it should raise an error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

please make it changes, @Prikshit7766 @RakshitKhajuria

@@ -1038,11 +1072,11 @@ def edit_testcases(self, output_path: str, **kwargs):
temp_df = temp_df[temp_df["category"].isin(["robustness", "bias"])]
temp_df.to_csv(output_path, index=False)

def import_edited_testcases(self, input_path: str, **kwargs):
def import_edited_testcases(self, input_path: dict, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

user can provide only the str of the input path. and we can convert it into the required dict format within the function.

@ArshaanNazir ArshaanNazir merged commit 73c2d25 into release/1.3.0 Aug 17, 2023
3 checks passed
@ArshaanNazir ArshaanNazir removed the v2.1.0 Issue or request to be done in v2.1.0 release label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit objects of multiple types
4 participants