{ "cells": [ { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2893037/1660114035.py:11: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.\n", " checkpoint = torch.load(model_path)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "met_joint_f78b0fa9c1d7718b9ed703ddcf621ec9_lf_sd_train_gen_4\n", "hybrid\n", "False\n", "met_joint_ffbdebf78d7907df10c789e0d8cc8992_lf_sd_train_final_runs_1\n", "hybrid\n", "False\n", "met_joint_aa985942ad294012e11cbc13fccf7de9_lf_sd_train_runs_5\n", "hybrid\n", "False\n", "met_joint_aa985942ad294012e11cbc13fccf7de9_lf_sd_train_runs_2\n", "hybrid\n", "False\n", "met_joint_b9386d26e9d1192471fa4b95de7b44ef_lf_sd_train_final_runs_2\n", "hybrid\n", "False\n", "met_joint_aa985942ad294012e11cbc13fccf7de9_lf_sd_train_runs_3\n", "hybrid\n", "False\n", "met_joint_aa985942ad294012e11cbc13fccf7de9_lf_sd_train_runs_1\n", "hybrid\n", "False\n", "met_joint_aa985942ad294012e11cbc13fccf7de9_lf_sd_train_runs_4\n", "hybrid\n", "False\n", "met_joint_abfff0992d2512e1fa18eb3444686071_lf_sd_train_gen_5\n", "hybrid\n", "False\n", "met_joint_fc741fbf5d3d3874c10921ddad5dca5b_lf_sd_train_final_runs_3\n", "hybrid\n", "False\n", "met_joint_d2df7853437ea532c03908843d3348b6_lf_sd_train_final_runs_5\n", "hybrid\n", "False\n", "met_joint_6d2fa90c72a23c2c9c4ebcf439b39d15_lf_sd_train_final_runs_4\n", "hybrid\n", "False\n" ] } ], "source": [ "import torch\n", "import os\n", "\n", "models_par = os.listdir('models_7_6_24')\n", "for model_dir in models_par:\n", " # if model_dir.startswith(\"met\"):\n", " # print(model_dir)\n", " model_path_folders = [\"models_7_6_24\", model_dir, \"best\", \"model.pth\"]\n", " model_path = os.path.join(*model_path_folders)\n", " if os.path.exists(model_path):\n", " checkpoint = torch.load(model_path)\n", " if 'type' in checkpoint['config']['model']['memory'] and checkpoint['config']['model']['memory']['type'] == 'hybrid':\n", " print(model_dir)\n", " print(checkpoint['config']['model']['memory']['type'])\n", " print(checkpoint['config']['model']['memory']['pivot'])\n", " # checkpoint['config']['model']['memory']['type'] = 'hybrid'\n", " # checkpoint['config']['model']['memory']['type'] = 'static'\n", " # torch.save(checkpoint, model_path)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "myenv", "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.2" } }, "nbformat": 4, "nbformat_minor": 2 }