{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "acb05338-490d-44c8-9923-7fb70d3465a2", "metadata": {}, "outputs": [], "source": [ "import torch\n", "import json\n", "class Config:pass" ] }, { "cell_type": "code", "execution_count": 2, "id": "7dcd2d48-0ad7-4cde-99f7-d8c719026a85", "metadata": {}, "outputs": [], "source": [ "walloc_20x = torch.load(\"Stereo_Li_27c_test2.pth\",map_location='cpu', weights_only=False)\n", "config = walloc_20x['config']\n", "with open('stereo_20x.json', 'w') as f:\n", " json.dump(config.__dict__, f, indent=4)\n", "del walloc_20x['config']\n", "torch.save(walloc_20x, 'stereo_20x.pth')" ] }, { "cell_type": "code", "execution_count": 3, "id": "0b5ddce5-8f83-484b-9a86-b6e3b799904c", "metadata": {}, "outputs": [], "source": [ "walloc_5x = torch.load(\"Stereo_Li_108c_test2.pth\",map_location='cpu', weights_only=False)\n", "config = walloc_5x['config']\n", "with open('stereo_5x.json', 'w') as f:\n", " json.dump(config.__dict__, f, indent=4)\n", "del walloc_5x['config']\n", "torch.save(walloc_5x, 'stereo_5x.pth')" ] }, { "cell_type": "code", "execution_count": 4, "id": "0de59093-db74-4b08-ac45-f1b832529dcb", "metadata": {}, "outputs": [], "source": [ "walloc_16x = torch.load(\"RGB_Li_12c_J3_nf8_v1.0.2.pth\",map_location='cpu', weights_only=False)\n", "config = walloc_16x['config']\n", "with open('RGB_16x.json', 'w') as f:\n", " json.dump(config.__dict__, f, indent=4)\n", "del walloc_16x['config']\n", "del walloc_16x['i_epoch']\n", "del walloc_16x['learning_rates']\n", "del walloc_16x['dist_losses']\n", "torch.save(walloc_16x, 'RGB_16x.pth')" ] }, { "cell_type": "code", "execution_count": 5, "id": "235117df-ddf4-4f72-a5a8-8395412f8eff", "metadata": {}, "outputs": [], "source": [ "walloc_4x = torch.load(\"RGB_Li_48c_J3_nf8_v1.0.2.pth\",map_location='cpu', weights_only=False)\n", "config = walloc_4x['config']\n", "with open('RGB_4x.json', 'w') as f:\n", " json.dump(config.__dict__, f, indent=4)\n", "del walloc_4x['config']\n", "del walloc_4x['i_epoch']\n", "del walloc_4x['learning_rates']\n", "del walloc_4x['dist_losses']\n", "torch.save(walloc_4x, 'RGB_4x.pth')" ] } ], "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 }