From 6d1f734d4215e48ccf69b7bda0388deb717a53f9 Mon Sep 17 00:00:00 2001 From: HU <franck.hu@ecl20.ec-lyon.fr> Date: Mon, 20 Nov 2023 14:01:13 +0100 Subject: [PATCH] maj --- TD2 Deep Learning.ipynb | 41 +++++++++++++++++- ...osch-South-Africa-closeup-1-DHD.jpg.icloud | Bin 0 -> 254 bytes 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 hymenoptera_data/test/ants/.ants-devouring-remains-of-large-dead-insect-on-red-tile-in-Stellenbosch-South-Africa-closeup-1-DHD.jpg.icloud diff --git a/TD2 Deep Learning.ipynb b/TD2 Deep Learning.ipynb index b7f5695..0d885ba 100644 --- a/TD2 Deep Learning.ipynb +++ b/TD2 Deep Learning.ipynb @@ -23769,12 +23769,20 @@ "print_size_of_model(model, \"fp32\")" ] }, + { + "cell_type": "markdown", + "id": "d1fc547c", + "metadata": {}, + "source": [ + "### La taille du modèle 1 initial est de 251.278 KB" + ] + }, { "cell_type": "markdown", "id": "05c4e9ad", "metadata": {}, "source": [ - "Post training quantization example" + "### On va compresser ce modèle : " ] }, { @@ -23804,11 +23812,18 @@ "source": [ "import torch.quantization\n", "\n", - "\n", "quantized_model = torch.quantization.quantize_dynamic(model, dtype=torch.qint8)\n", "print_size_of_model(quantized_model, \"int8\")" ] }, + { + "cell_type": "markdown", + "id": "70bd3046", + "metadata": {}, + "source": [ + "### Le modèle compressé a une taille de 76.522 KB. Il y a donc eu une réduction de 174.756 KB." + ] + }, { "cell_type": "code", "execution_count": 19, @@ -23897,6 +23912,20 @@ ")" ] }, + { + "cell_type": "markdown", + "id": "50c95c3e", + "metadata": {}, + "source": [ + "### En terme de précision, elle est la même en pourcentage pour presque toutes les classes (en comparaison avec le modèle non compressé).\n", + "\n", + "#### Elle difére de 1% pour la classe horse.\n", + "\n", + "### Au global, la précision est la même.\n", + "\n", + "### Le modèle compressé conserve la précision du modèle tout en réduisant sa taille." + ] + }, { "cell_type": "markdown", "id": "7b108e17", @@ -23913,6 +23942,14 @@ "Try training aware quantization to mitigate the impact on the accuracy (doc available here https://pytorch.org/docs/stable/quantization.html#torch.quantization.quantize_dynamic)" ] }, + { + "cell_type": "markdown", + "id": "a5ba7855", + "metadata": {}, + "source": [ + "### On va essayer le training aware quantization" + ] + }, { "cell_type": "markdown", "id": "201470f9", diff --git a/hymenoptera_data/test/ants/.ants-devouring-remains-of-large-dead-insect-on-red-tile-in-Stellenbosch-South-Africa-closeup-1-DHD.jpg.icloud b/hymenoptera_data/test/ants/.ants-devouring-remains-of-large-dead-insect-on-red-tile-in-Stellenbosch-South-Africa-closeup-1-DHD.jpg.icloud new file mode 100644 index 0000000000000000000000000000000000000000..6f5e2546ea17972a4437948bbb1ffd6a582d82a8 GIT binary patch literal 254 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?4!~w8XrUV%?O~vi#Db%)E5nqSV~P%)DaV{50L1#G>?6-IUbC6y40c;?(34 z-TXY=qSO@KlFXb`-ON1Q;F8pwoYcIe{Nm&c-QfJvk_=tPw4%)9MBU_^{NmKo0$oF0 y7Y`S`tb%kQ1_i;T@d7ef9TJq9UYe6w#KAA4@3nac0~jzef++?Db|?*_t^)weK~4w& literal 0 HcmV?d00001 -- GitLab