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 new endpoints for workflows and prepare for future deprecation #336

Conversation

PawelPeczek-Roboflow
Copy link
Collaborator

@PawelPeczek-Roboflow PawelPeczek-Roboflow commented Mar 27, 2024

Description

There were couple of changes in this PR:

Changes in workflows endpoints

image

Adjusted sdk client to changes

image

Maintained backward compatibility of endpoints

  • old endpoints are still alive, sunset day is set in docs
  • there is deprecation warning on old methods
  • API docs also contain deprecation warning

Provided self-descriptive capabilities for workflows blocks and endpoints to describe all loaded steps

image
  • introduced notion of reference kinds - which is simple type-system on referred values
  • without detailed knowledge of steps, just based on definitions we can do multiple things:
    • deduce which step can be connected to which other:
    • it is possible to prepare generic entities builder
image image

Provided endpoint to validate workflows JSON definitions

image

Improved significantly workflows syntax validation by establishing typedefs with constraint checks in pydantic

OLD:
image

NEW:
image

Thanks to that: ➖ 900 lines of code

Registered workflows in InferencePipeline

image

Fixed couple of bugs

  • YoloWorld in workflows at hosted platform
  • wrong definition of detection filter filtering claims

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?

  • CI still 🟢 - most importantly our validators for syntax and semantic of workflows - which means that we shall not expect breaking change in that
  • new tests added for new functionality
  • deployed and tested @ staging (with load tests and tests of new functionalities executed)

Any specific deployment considerations

  • tested at staging, postponing PROD deployment to next week due to holidays
  • should not be breaking in terms of workflows contract

Docs

  • Docs updated? What were the changes: workflows, InferencePipeline inference_sdk

@PawelPeczek-Roboflow PawelPeczek-Roboflow marked this pull request as ready for review March 29, 2024 11:45
Copy link
Contributor

@yeldarby yeldarby left a comment

Choose a reason for hiding this comment

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

Only got partway through reviewing but have to go into meetings for a bit. Will finish later but wanted to get these comments out there.

inference/core/interfaces/stream/inference_pipeline.py Outdated Show resolved Hide resolved
description="Parameter to decide if Active Learning data sampling is disabled for the model",
examples=[True, "$inputs.disable_active_learning"],
)
active_learning_target_dataset: Union[
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be useful to add an array of tag strings that get added to the uploaded images.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

would be, but this is also possible in AL config that can be declared in-place. We can add this feature, but I would put that into to-do for next iteration

Copy link
Contributor

Choose a reason for hiding this comment

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

this is also possible in AL config that can be declared in-place

Can you clarify? I don't think I understand what this is

I would put that into to-do for next iteration

Sounds good

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is also possible in AL config that can be declared in-place -> you can request specific tags to be added via config of AL that can be defined either at project level or in-place

@@ -432,31 +511,44 @@ def validate_field_binding(self, field_name: str, value: Any) -> None:


class InstanceSegmentationModel(ObjectDetectionModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an easy way to know from the manifest whether something is a subclass of BaseModel? I think right now I just check if the name ends in _model

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do you mean BaseModel or RoboflowModel.
If the former - each manifest class must be derived after pydantic.BaseModel
If the latter - no way now - I feel like additional metadata about steps can be held in

model_config = ConfigDict(
        json_schema_extra={
            "description": "This block represents inference from Roboflow multi-class classification model.",
            "docs": "https://inference.roboflow.com/workflows/classify_objects", <- additional keys here
        }
    )

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that in the manifest? I don't see BaseModel or base_model in there anywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no it is not, that's just required for pydantic to work

inference/enterprise/workflows/entities/steps.py Outdated Show resolved Hide resolved
@@ -676,15 +855,26 @@ def validate_field_binding(self, field_name: str, value: Any) -> None:


class BarcodeDetection(BaseModel, StepInterface):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename this BarcodeModel since it inherits from BaseModel? (At the least should be BarcodeDetector vs Detection to match the part of speech of other blocks)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's pydantic.BaseModel.
BarcodeDetector is fine, we would also need to change QRCodeDetection in the same way

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, changed.
Also made the change non-breaking by double-aliasing step type - we will sun-set old ones in some time

Copy link
Contributor

Choose a reason for hiding this comment

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

Also wonder if eg YoloWorld should be called YoloWorldModel

inference/enterprise/workflows/entities/steps.py Outdated Show resolved Hide resolved
@PawelPeczek-Roboflow
Copy link
Collaborator Author

I am branching out from this ref. point to re-structure the workflows steps - I propose to only fix issues in this PR, additional feature requests I will implement later

Copy link
Contributor

@yeldarby yeldarby left a comment

Choose a reason for hiding this comment

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

Read through the rest & looks good!

@@ -432,31 +511,44 @@ def validate_field_binding(self, field_name: str, value: Any) -> None:


class InstanceSegmentationModel(ObjectDetectionModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that in the manifest? I don't see BaseModel or base_model in there anywhere.

@PawelPeczek-Roboflow PawelPeczek-Roboflow merged commit e095fc7 into main Apr 3, 2024
26 checks passed
@PawelPeczek-Roboflow PawelPeczek-Roboflow deleted the feature/adjust_workflows_endpoints_add_descriptive_and_validation_capabilities branch April 3, 2024 18:29
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.

None yet

2 participants