Delete Models/del_training.ipynb
Browse files- Models/del_training.ipynb +0 -62
Models/del_training.ipynb
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"id": "2b6bb4be",
|
7 |
-
"metadata": {},
|
8 |
-
"outputs": [],
|
9 |
-
"source": [
|
10 |
-
"import os\n",
|
11 |
-
"import torch"
|
12 |
-
]
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"cell_type": "code",
|
16 |
-
"execution_count": null,
|
17 |
-
"id": "dc802b47",
|
18 |
-
"metadata": {},
|
19 |
-
"outputs": [],
|
20 |
-
"source": [
|
21 |
-
"models_path = \"./current_model_120k_vi.pth\"\n",
|
22 |
-
"name = \"./model.pth\"\n",
|
23 |
-
"params_whole = torch.load(models_path, map_location='cpu')\n",
|
24 |
-
"\n",
|
25 |
-
"for key in list(params_whole.keys()):\n",
|
26 |
-
" if key != 'net':\n",
|
27 |
-
" params_whole.pop(key)\n",
|
28 |
-
"\n",
|
29 |
-
"keep = ['decoder', 'predictor', 'text_encoder', 'style_encoder']\n",
|
30 |
-
"for module_name in list(params_whole['net'].keys()):\n",
|
31 |
-
" if module_name not in keep:\n",
|
32 |
-
" params_whole['net'].pop(module_name)\n",
|
33 |
-
"\n",
|
34 |
-
"torch.save(params_whole, name)\n",
|
35 |
-
"\n",
|
36 |
-
"\n",
|
37 |
-
"#os.remove(models_path)"
|
38 |
-
]
|
39 |
-
}
|
40 |
-
],
|
41 |
-
"metadata": {
|
42 |
-
"kernelspec": {
|
43 |
-
"display_name": "base",
|
44 |
-
"language": "python",
|
45 |
-
"name": "python3"
|
46 |
-
},
|
47 |
-
"language_info": {
|
48 |
-
"codemirror_mode": {
|
49 |
-
"name": "ipython",
|
50 |
-
"version": 3
|
51 |
-
},
|
52 |
-
"file_extension": ".py",
|
53 |
-
"mimetype": "text/x-python",
|
54 |
-
"name": "python",
|
55 |
-
"nbconvert_exporter": "python",
|
56 |
-
"pygments_lexer": "ipython3",
|
57 |
-
"version": "3.11.7"
|
58 |
-
}
|
59 |
-
},
|
60 |
-
"nbformat": 4,
|
61 |
-
"nbformat_minor": 5
|
62 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|