{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "950d36bf-2792-434e-920d-31954ec49878", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "text_projection.npy: 6.3 MB\n" ] } ], "source": [ " import os\n", " npy_path = \"/workspace/sdxl_tflite/text_projection.npy\"\n", " size_mb = os.path.getsize(npy_path) / 1024 / 1024\n", " print(f\"text_projection.npy: {size_mb:.1f} MB\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "0db2e3ce-274a-4af3-bdd3-87886afd603a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Done: (1280, 1280), float32\n" ] } ], "source": [ " import numpy as np\n", " tp = np.load(\"/workspace/sdxl_tflite_fp16/text_projection.npy\")\n", " tp.astype(np.float32).tofile(\"/workspace/sdxl_tflite_fp16/text_projection.bin\")\n", " print(f\"Done: {tp.shape}, {tp.dtype}\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "eb0f13c8-4ac0-4e8e-b717-5e4723b49e93", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/workspace/sdxl_tflite/clip.tflite: 470 MB\n", "/workspace/sdxl_tflite/open_clip.tflite: 2644 MB\n", "/workspace/sdxl_tflite/diffusion.tflite: 9800 MB\n", "/workspace/sdxl_tflite/decoder.tflite: 189 MB\n", "\n", "/workspace/sdxl_tflite_fp16/clip.tflite: 235 MB\n", "/workspace/sdxl_tflite_fp16/open_clip.tflite: 1323 MB\n", "/workspace/sdxl_tflite_fp16/diffusion.tflite: 4906 MB\n", "/workspace/sdxl_tflite_fp16/decoder.tflite: 95 MB\n", "\n" ] } ], "source": [ " import os\n", " for d in [\"/workspace/sdxl_tflite\", \"/workspace/sdxl_tflite_fp16\"]:\n", " if os.path.exists(d):\n", " for f in [\"clip.tflite\", \"open_clip.tflite\", \"diffusion.tflite\", \"decoder.tflite\"]:\n", " path = f\"{d}/{f}\"\n", " if os.path.exists(path):\n", " size = os.path.getsize(path) / 1024 / 1024\n", " print(f\"{d}/{f}: {size:.0f} MB\")\n", " print()" ] }, { "cell_type": "code", "execution_count": 5, "id": "4409a65f-e9b8-417a-98a3-6683c8e3d6f2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "FP16 clip: 235 MB\n" ] } ], "source": [ " # 원격 서버에서 실행\n", " import os\n", " size = os.path.getsize(\"/workspace/sdxl_tflite_fp16/clip.tflite\")\n", " print(f\"FP16 clip: {size / 1024 / 1024:.0f} MB\")" ] }, { "cell_type": "code", "execution_count": 6, "id": "d1b11b7e-3acd-4f78-a091-36f628198fc3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/workspace/sdxl_tflite_quantized/clip.tflite: 120 MB\n", "/workspace/sdxl_tflite_quantized/open_clip.tflite: 668 MB\n", "/workspace/sdxl_tflite_quantized/diffusion.tflite: 2476 MB\n", "/workspace/sdxl_tflite_quantized/decoder.tflite: 48 MB\n" ] } ], "source": [ " import os\n", " # INT8 모델 경로 확인\n", " for d in [\"/workspace/sdxl_tflite_quantized\", \"/tmp/sdxl_tflite_quantized\"]:\n", " if os.path.exists(d):\n", " for f in os.listdir(d):\n", " if f.endswith('.tflite'):\n", " size = os.path.getsize(f\"{d}/{f}\") / 1024 / 1024\n", " print(f\"{d}/{f}: {size:.0f} MB\")" ] }, { "cell_type": "code", "execution_count": null, "id": "3b16e345-80ad-495f-8151-8a1664b5446f", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 5 }