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

Fix model type for classification #773

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

robiscoding
Copy link
Contributor

@robiscoding robiscoding commented Nov 4, 2024

Description

  • Classification inference requests don't have a null model_type which is causing downstream issues in Model Monitoring (missing label/misreporting)
  • This change manually sets the classification model type and adds some unit tests
  • [Update] added support for other major model types to be collected in model monitoring (omitting core model info for now)

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)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

  • Tested that classification projects have a defined model_type when making a legacy infer request and checking the item in a local cache
  • Added unit tests for the serializers file

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

@robiscoding robiscoding marked this pull request as ready for review November 4, 2024 21:09
]
predictions = []
for pred in response.predictions:
if type(pred) == str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use isinstance(pred, str)

Copy link
Collaborator

Choose a reason for hiding this comment

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

if the clause is supposed to handle multi-label cls - then this is wrong approach whatsoever - please refer to response schemas

for pred in response.predictions:
if type(pred) == str:
predictions.append(
{"class": pred, "confidence": request.confidence}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is not that clear for me - why to put a request confidence into predicted class name? That's the model which dictates confidence of prediction, request do only have threshold

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was mistake, good catch

)


class TestSerializersClassification(unittest.TestCase):
Copy link
Collaborator

Choose a reason for hiding this comment

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

we do not use unittest, but pytest - please adjust to the standard tool in repo

@PawelPeczek-Roboflow PawelPeczek-Roboflow merged commit c0f4bc7 into main Nov 7, 2024
71 checks passed
@PawelPeczek-Roboflow PawelPeczek-Roboflow deleted the fix-classification-caching branch November 7, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants