Skip to content

Huggingface models: convert dataframe to list of dicts if using pipeline#1323

Merged
mattbit merged 3 commits intomainfrom
task/GSK-1482
Aug 28, 2023
Merged

Huggingface models: convert dataframe to list of dicts if using pipeline#1323
mattbit merged 3 commits intomainfrom
task/GSK-1482

Conversation

@mattbit
Copy link
Copy Markdown
Member

@mattbit mattbit commented Aug 21, 2023

No description provided.

@linear
Copy link
Copy Markdown

linear Bot commented Aug 21, 2023

GSK-1482 Fix problem with HF pipeline models

HuggingFaceModel casts input to list before passing to the pipeline, but if the input is a dataframe (which is the case when the user did not provide a data_preprocessing_function) when casted to a list it will return the list of column names.

@mattbit mattbit requested a review from andreybavt August 21, 2023 15:39
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

80.0% 80.0% Coverage
0.0% 0.0% Duplication


def _get_predictions(self, data):
if isinstance(self.model, pipelines.Pipeline):
if isinstance(data, pd.DataFrame):
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.

did it break without to_dict conversion? Should we add another unit test specifically for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, when no preprocessing function was specified

@mattbit mattbit merged commit 8b7b9b1 into main Aug 28, 2023
@Hartorn Hartorn deleted the task/GSK-1482 branch September 13, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants