Skip to content

Unit 9: Model optimization (Model Deployment Considerations)#123

Merged
merveenoyan merged 27 commits into
huggingface:mainfrom
adhiiisetiawan:main
Dec 25, 2023
Merged

Unit 9: Model optimization (Model Deployment Considerations)#123
merveenoyan merged 27 commits into
huggingface:mainfrom
adhiiisetiawan:main

Conversation

@kiluazen

Copy link
Copy Markdown
Contributor

Hi, everyone.

This is content for Unit 9: Model Optimization => Module 3 (Model Deployment).
Here's the outline for reference: https://github.com/johko/computer-vision-course/discussions/92

Please Read through and suggest topics I am missing, redundant parts that need to be excluded etc.

Thank you.

@mmhamdy mmhamdy left a comment

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.

Looking great! just have one question: is this part of a larger chapter on deployment?

Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated
Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated


- **Kubernetes Documentation**: [Kubernetes](https://kubernetes.io/docs/home/) is an open-source container orchestration platform widely used for deploying and managing applications. Understanding Kubernetes can help deploy models in a scalable and reliable manner.
## Best Practices for Deployment in Production

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.

Hi @kiluazen sorry just notice, i think in this section you can add like "model optimization" part. So, one of best practices before deployment is "optimize the model", and because the deployment is important (reduce latency, etc), we need to optimize the model first (depend on where we will deploy the model (ex: cloud, mobile, edge devices))

what do you think?

@merveenoyan merveenoyan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I mostly did nitpicking, thank you!


## Different Deployment Platforms
- **Cloud**: Deploying models on cloud platforms like AWS, Google Cloud, or Azure offers a scalable and robust infrastructure for AI model deployment. These platforms provide managed services for hosting models, ensuring scalability, flexibility, and integration with other cloud services.
- Advantages: Scalability, high computing power, managed services, integration with cloud ecosystem.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe you can make a statement here for clarity, e.g. Cloud deployment is easily scalable by means of computing power and memory (and so on)
same goes for the rest of the text

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is waiting to be addressed

Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx
Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated
Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated

- **Packaging:** Packaging, on the other hand, involves bundling all the necessary components and dependencies of a machine learning model. It's like putting all the puzzle pieces into a box, along with the instructions on assembling it. Packaging includes everything needed to run the model, such as the serialized model file, pre-processing or post-processing code, and required libraries or dependencies.

Serialization is device-agnostic When packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Serialization is device-agnostic When packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.
Serialization is device-agnostic when packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.

Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated
Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated
Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx
- **Load Testing**: Simulate varying workloads to ensure the model's responsiveness under different conditions.

- **Anomaly Detection**: Implement systems to detect deviations in model behavior and performance.
- **Real-time Monitoring**: Utilize tools for immediate identification of issues in deployed models.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

giving an example of an issue (e.g. distribution shift) would be nice

Comment thread chapters/en/Unit 9 - Model Optimization/model_deployment.mdx Outdated

@MKhalusova MKhalusova left a comment

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.

LGTM, thanks for writing this!


- **Packaging:** Packaging, on the other hand, involves bundling all the necessary components and dependencies of a machine learning model. It's like putting all the puzzle pieces into a box, along with the instructions on assembling it. Packaging includes everything needed to run the model, such as the serialized model file, pre-processing or post-processing code, and required libraries or dependencies.

Serialization is device-agnostic When packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.

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.

Suggested change
Serialization is device-agnostic When packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.
Serialization is device-agnostic when packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.


Serialization is device-agnostic When packaging for cloud deployment. Serialized models are often packaged into containers (e.g., Docker) or deployed as web services (e.g., Flask or FastAPI). Cloud deployments also involve auto-scaling, load balancing, and integration with other cloud services.

## Model Serving and Inference

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.

This would be a great place to mention Inference Endpoints - https://huggingface.co/inference-endpoints

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.

wow, cool. I just found out that huggingface has this.

@merveenoyan

Copy link
Copy Markdown
Collaborator

@kiluazen Can you incorporate @MKhalusova's changes and I'll give another review and we can merge next?

adhiiisetiawan and others added 10 commits December 21, 2023 00:33
Co-authored-by: Mohammed Hamdy <62081584+mmhamdy@users.noreply.github.com>
Co-authored-by: Mohammed Hamdy <62081584+mmhamdy@users.noreply.github.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
@@ -0,0 +1,52 @@
# Model Deployment Considerations

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you briefly mention here what this chapter will talk about? e.g. "In this chapter we will go through various deployment practices"


## Different Deployment Platforms
- **Cloud**: Deploying models on cloud platforms like AWS, Google Cloud, or Azure offers a scalable and robust infrastructure for AI model deployment. These platforms provide managed services for hosting models, ensuring scalability, flexibility, and integration with other cloud services.
- Advantages: Scalability, high computing power, managed services, integration with cloud ecosystem.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is waiting to be addressed

@kiluazen

Copy link
Copy Markdown
Contributor Author

Hey @merveenoyan @MKhalusova, I have made the changes.
Please comment and suggest for further improvement .
Sorry for the late response.

@merveenoyan merveenoyan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me! waiting for a community contributor to approve and we can merge

@merveenoyan
merveenoyan merged commit d185c35 into huggingface:main Dec 25, 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.

5 participants