-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement Model Switching Functionality in Inference Request #51
Comments
- Added model_name parameter handling in inference_request function. - Created model_mapping dictionary to map model names to their respective processing functions. - Integrated dynamic model selection based on the model_name parameter. - Ensured consistent data structure for process_inference_results function across different models. #51 #31
Inference Request with n pipelinesGlossaryPipelinesPipelines are define as a set of models that follow each others where output of flowchart LR
A{Pipeline entry point}-->|user input|SB1-->F{Pipeline exit point}-->|"last model
output"|G>"return
result.json to user"]
subgraph SB1[In pipeline]
direction TB
B(model 01)-->|"model output
send to the next one"|C(model 02)-->|can have n models|D(n models)
end
ModelsA model is a AI model who's part of a pipeline. A model accept images as input Model from FrontendOn the frontend interface, a pipeline will be call a model, since the user will Suggestion: we could call the pipeline a method, if we don't want to mix term. Sequence Diagram for inference requestsequenceDiagram
actor Client
participant Frontend
participant Backend
participant Blob storage
participant Model
Note over Backend,Blob storage: initialisation
Backend-)Backend: before_serving()
Backend-)Backend: get_pipelines_models()
alt
Backend-)Blob storage: HTTP POST req.
Blob storage--)Backend: return pipelines_models.json
else
Backend-)Frontend: error 400 No pipeline found
end
Note over Backend,Blob storage: end of initialisation
Client->>Frontend: applicationStart()
Frontend-)Backend: HTTP POST req.
Backend-)Backend: get_pipelines_names()
Note right of Backend: return pipelines names set(pipelines.keys())
Backend--)Frontend: Pipelines names res.
Frontend->>Client: application is ready
Client-->>Frontend: client ask action from specific pipeline
Frontend-)Backend: HTTP POST req.
Backend-)Backend: inference_request(pipeline_name, folder_name, container_name, imageDims, image)
alt missing argument
Backend--)Frontend: Error 400 missing arguments
else no missing argument
Backend-)Backend: mount_container(connection_string(Environnement Variable, container_name))
Backend-)Blob storage: HTTP POST req.
Blob storage--)Backend: container_client
Backend-)Backend: upload_image(container_client, folder_name, image_bytes, hash_value)
Backend-)Blob storage: HTTP POST req.
Blob storage--)Backend: blob_name
Backend-)Backend: get_blob(container_client, blob_name)
Backend-)Blob storage: HTTP POST req.
Blob storage--)Backend: blob
loop for every model in pipeline
Note over Backend,Blob storage: Need to build endpoint with pipeline_name
Backend-)Backend: urllib.request.Request(endpoint_url, body, header)
Backend-)Model: HTTP POST req.
Model--)Backend: result.json
end
par Backend to Frontend
Backend--)Frontend: Processed result res.
and Backend to Blob storage
Backend-)Backend: upload_inference_result(container_client, folder_name, result_json_string, hash_value)
Backend-)Blob storage: HTTP POST req.
end
end
Frontend--)Client: display result
|
@MaxenceGui before_serving was an example, should be applied to the rest of the code too; calls between processes are done to through the protocol linking them (example: HTTP GET/POST), not function calls (which would imply RPC calls). |
…d update app.py with new imports and function calls
fixes #51: correcting markdown lint
fixes #51: Correct trailing whitespace and EOF.
fixes #51: Move insert_new_version_pipeline to pipelines_version_insertion.py
* # fixes #64: Add MAX_CONTENT_LENGTH env * fixes #64 Add devSecOps variable name * fixes #64: fix typo * Update README.md Co-authored-by: Jonathan Lopez <[email protected]> * Update .env.template Co-authored-by: Jonathan Lopez <[email protected]> * isssue #64: Get rid of eval --------- Co-authored-by: Jonathan Lopez <[email protected]> fixes #51: connecting to swin model fixes #51: refactor exception fixes #51: add request_factory function to bring a standard to call model fixes #51: add models_Utils.py fixes #51: Update model_utilitary_functions import fixes #51: update result parsing and add default pipeline fixes #51: update inference_request to call swin in loop fixes #51: Standardize headers with azureml-model-deployment being mandantory fixes #51: correct failed check from workflows fixes #51: Refactor inference result processing and add test file for inference request fixes #51: Change the categories model name fixes #51: implement model module request inference function fixes #51: add function to retrieve pipeline info from blob storage fixes #51: Add script to upload to blob storage json file containing pipeline fixes #51: correct lint error Update nachet-inference-documentation.md to reflect code change fixes #51: Update sequence diagram fixes #51: update README and TESTING fixes #51: correcting markdown lint fixes #51: Add inference request test fixes #51: inference test with Quart.test_client fixes #51: Correct lint ruff error and tests fixes #51: implement Ricky reviews Update CODEOWNERS file Update CODEOWNERS file fixes #64: Increase MAX_CONTENT_LENGTH (#66) * # fixes #64: Add MAX_CONTENT_LENGTH env * fixes #64 Add devSecOps variable name * fixes #64: fix typo * Update README.md Co-authored-by: Jonathan Lopez <[email protected]> * Update .env.template Co-authored-by: Jonathan Lopez <[email protected]> * isssue #64: Get rid of eval --------- Co-authored-by: Jonathan Lopez <[email protected]>
issue #51: Modify documentation to reflect change on Model namedtuple
* Update Sequence Diagram README.md ![SD_1 drawio (2)](https://github.com/ai-cfia/nachet-backend/assets/19809069/272f37dc-f4ec-449b-ba82-950c54b9f856) issue #51: Fixing Markdown lint issue #51: fixing MD lint
issue #62: correct multiple import ruff error
fixes #51: implement pipeline switching in back end
Issue Description
The goal is to implement model switching functionality in the
inference_request
function, allowing it to handle different models based on themodel_name
parameter passed in the request. An issue arises when the system tries to access a model function that is not implemented, leading to an error.Steps to Reproduce
/inf
endpoint withmodel_name
set to a value that does not correspond to an implemented model function.model_name
and fails if the function is not implemented.Expected Behavior
The
inference_request
function should dynamically select and call the correct model processing function based on themodel_name
provided in the request. If amodel_name
is provided that does not have an associated processing function, the system should handle it gracefully.Current Behavior
The system throws an error indicating that the required model processing function is not found in the
model_inference.inference
module when a non-implementedmodel_name
is used.Possible Solution
Implement a check within the
inference_request
function to ensure that themodel_name
provided in the request corresponds to an implemented model processing function. If not, the system should return a meaningful error message or default to a general processing function.Additional Context
Tasks
model_inference.inference
module.inference_request
function.model_name
does not correspond to an implemented model processing function.The text was updated successfully, but these errors were encountered: