forked from Harry-zklcdc/go-proxy-bingai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent
148 lines (148 loc) · 4 KB
/
content
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "HyperLSTM",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "AYV_dMVDxyc2"
},
"source": [
"[](https://github.com/labmlai/annotated_deep_learning_paper_implementations)\n",
"[](https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/hypernetworks/experiment.ipynb) \n",
"\n",
"## HyperLSTM\n",
"\n",
"This is an experiment training Shakespear dataset with HyperLSTM from paper HyperNetworks."
]
},
{
"cell_type": "code",
"metadata": {
"id": "ZCzmCrAIVg0L"
},
"source": [
"!pip install labml-nn"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"metadata": {
"id": "0hJXx_g0wS2C"
},
"source": [
"from labml import experiment\n",
"from labml_nn.hypernetworks.experiment import Configs"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"metadata": {
"id": "WQ8VGpMGwZuj"
},
"source": [
"# Create experiment\n",
"experiment.create(name=\"hyper_lstm\", comment='')\n",
"# Create configs\n",
"conf = Configs()\n",
"# Load configurations\n",
"experiment.configs(conf,\n",
" # A dictionary of configurations to override\n",
" {'tokenizer': 'character',\n",
" 'text': 'tiny_shakespeare',\n",
" 'optimizer.learning_rate': 2.5e-4,\n",
" 'optimizer.optimizer': 'Adam',\n",
" 'prompt': 'It is',\n",
" 'prompt_separator': '',\n",
"\n",
" 'rnn_model': 'hyper_lstm',\n",
"\n",
" 'train_loader': 'shuffled_train_loader',\n",
" 'valid_loader': 'shuffled_valid_loader',\n",
"\n",
" 'seq_len': 512,\n",
" 'epochs': 128,\n",
" 'batch_size': 2,\n",
" 'inner_iterations': 25})\n",
"\n",
"\n",
"# Set models for saving and loading\n",
"experiment.add_pytorch_models({'model': conf.model})\n",
"\n",
"conf.init()"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"metadata": {
"id": "f07vAOaHwumr"
},
"source": [
"# Start the experiment\n",
"with experiment.start():\n",
" # `TrainValidConfigs.run`\n",
" conf.run()"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"metadata": {
"id": "crH6MzKmw-SY"
},
"source": [],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": [
"/content/sample_data"
],
"metadata": {
"id": "gSTod2tdmxJq"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "VSGzg0kzm1QH"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"id": "VgJUq7Wmm28Y"
},
"execution_count": null,
"outputs": []
}
]
}