TensorFlow is a relatively large framework, with an unpacked size of approximately 1.7 GB. The size of such frameworks is an important consideration for several reasons:
- 📜 Historical Constraints: Previously, AWS Lambda imposed a limit of
50 MB
for package sizes. While Docker has since increased these limits to 10 GB, the size of the framework still plays a crucial role in certain scenarios. - ⚡ Performance Issues with Large Images: Large frameworks like TensorFlow result in increased storage costs, longer initialization times (e.g., for invoking a Lambda function), slower loading times, and a significantly larger RAM footprint.
To address these challenges, TensorFlow Lite (TF-Lite) provides a lightweight alternative designed specifically for inference tasks (i.e., making predictions with model.predict(X)
), excluding any other functionality such as training. To use TensorFlow Lite, the original TensorFlow model needs to be converted into the TF-Lite format. This process can significantly reduce model size and improve performance.
New URL for downloading the model:
wget https://github.com/DataTalksClub/machine-learning-zoomcamp/releases/download/chapter7-model/xception_v4_large_08_0.894.h5 -O clothing-model.h5
Add notes from the video (PRs are welcome)
- tensorflow has a size of approximately 1.7 GB
- there are size limits of cloud services and docker container
- tensorflow lite is small in size and limited to using a model to make predictions (inference)
- convert tensorflow keras model to a tensorflow lite model
The notes are written by the community. If you see an error here, please create a PR with a fix. |