Spaces:
Sleeping
Sleeping
File size: 4,158 Bytes
32d2d2c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
{
"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
}
|