File size: 8,633 Bytes
4c27541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
{
  "schema": "wrsi.model_spec.film_policy.v1",
  "model_id": "mdb8464d0",
  "arch": "film_policy",
  "kind": "policy",
  "input": {
    "kind": "observation rows",
    "dtype": "int64",
    "shape": [
      197
    ],
    "layout": "int64 [197]: the grid [x, y, channel] in C order (192 values), then 5 word ids",
    "grid": {
      "width": 8,
      "height": 8,
      "cell": "(object index, color index, state)",
      "order": "x (column, 0 = west) outer, y (row, 0 = north) middle, channel inner",
      "objects": [
        {
          "index": 0,
          "name": "unseen"
        },
        {
          "index": 1,
          "name": "empty"
        },
        {
          "index": 2,
          "name": "wall"
        },
        {
          "index": 3,
          "name": "floor"
        },
        {
          "index": 4,
          "name": "door"
        },
        {
          "index": 5,
          "name": "key"
        },
        {
          "index": 6,
          "name": "ball"
        },
        {
          "index": 7,
          "name": "box"
        },
        {
          "index": 8,
          "name": "goal"
        },
        {
          "index": 9,
          "name": "lava"
        },
        {
          "index": 10,
          "name": "agent"
        }
      ],
      "colors": [
        {
          "index": 0,
          "name": "red"
        },
        {
          "index": 1,
          "name": "green"
        },
        {
          "index": 2,
          "name": "blue"
        },
        {
          "index": 3,
          "name": "purple"
        },
        {
          "index": 4,
          "name": "yellow"
        },
        {
          "index": 5,
          "name": "grey"
        }
      ],
      "state": "door: 0 open, 1 closed, 2 locked; on the agent's cell its facing direction: 0 east (+x), 1 south (+y), 2 west (-x), 3 north (-y); 0 on every other cell",
      "agent": "exactly one cell has object index 10 (agent); its color index is 0 and its state the direction. The cell in front of the agent is (x, y) + (1, 0), (0, 1), (-1, 0) or (0, -1) for direction 0, 1, 2, 3",
      "walls": "the outer ring of cells is wall; the room's interior is 6 x 6",
      "carrying": "not encoded"
    },
    "instruction": {
      "length": 5,
      "layout": "[verb, verb, article, color, type] as word ids",
      "words": [
        {
          "id": 0,
          "word": "go",
          "meaning": "verb of the trained mission (\"go to\")"
        },
        {
          "id": 1,
          "word": "to",
          "meaning": "verb of the trained mission (\"go to\")"
        },
        {
          "id": 2,
          "word": "pick",
          "meaning": "reserved word; absent from all training rows (its embedding row is untrained)"
        },
        {
          "id": 3,
          "word": "up",
          "meaning": "reserved word; absent from all training rows (its embedding row is untrained)"
        },
        {
          "id": 4,
          "word": "the",
          "meaning": "article: \"the\" when exactly one object in the room matches the named color and type, \"a\" when several do"
        },
        {
          "id": 5,
          "word": "a",
          "meaning": "article: \"the\" when exactly one object in the room matches the named color and type, \"a\" when several do"
        },
        {
          "id": 6,
          "word": "red",
          "meaning": "color red (color index 0 in the grid)"
        },
        {
          "id": 7,
          "word": "green",
          "meaning": "color green (color index 1 in the grid)"
        },
        {
          "id": 8,
          "word": "blue",
          "meaning": "color blue (color index 2 in the grid)"
        },
        {
          "id": 9,
          "word": "purple",
          "meaning": "color purple (color index 3 in the grid)"
        },
        {
          "id": 10,
          "word": "yellow",
          "meaning": "color yellow (color index 4 in the grid)"
        },
        {
          "id": 11,
          "word": "grey",
          "meaning": "color grey (color index 5 in the grid)"
        },
        {
          "id": 12,
          "word": "ball",
          "meaning": "object type ball (object index 6 in the grid)"
        },
        {
          "id": 13,
          "word": "box",
          "meaning": "object type box (object index 7 in the grid)"
        },
        {
          "id": 14,
          "word": "key",
          "meaning": "object type key (object index 5 in the grid)"
        }
      ]
    }
  },
  "actions": [
    {
      "index": 0,
      "name": "left",
      "meaning": "turn left (direction - 1 mod 4)"
    },
    {
      "index": 1,
      "name": "right",
      "meaning": "turn right (direction + 1 mod 4)"
    },
    {
      "index": 2,
      "name": "forward",
      "meaning": "move one cell in the facing direction if that cell is empty"
    },
    {
      "index": 3,
      "name": "pickup",
      "meaning": "pick up the object in the facing cell if not carrying one"
    },
    {
      "index": 4,
      "name": "drop",
      "meaning": "drop the carried object in the facing cell if it is empty"
    },
    {
      "index": 5,
      "name": "toggle",
      "meaning": "toggle (open or close) the object in the facing cell"
    },
    {
      "index": 6,
      "name": "done",
      "meaning": "no effect in these missions"
    }
  ],
  "trained_mission": {
    "grammar": "go to {the|a} {color} {type}, color in red green blue purple yellow grey, type in ball box key",
    "room": "one 8 x 8 grid (6 x 6 interior) with 9 objects (balls, boxes, keys) and the agent; no doors",
    "success": "the episode succeeds when the agent faces (is next to and looking at) an object of the named color and type; it fails after 64 steps",
    "training": "imitation of a planner's actions on the trained mission only; the training actions are left, right and forward"
  },
  "parameter_layout": "PyTorch: embedding [rows, dim]; linear weight [out, in] and bias [out]; conv weight [out, in, 3, 3] and bias [out]; LayerNorm weight and bias [d_hidden]; all float32",
  "sizes": {
    "d_cell": 16,
    "d_word": 32,
    "d_instr": 128,
    "channels": 64,
    "d_hidden": 256
  },
  "n_parameters": 1151799,
  "tensors": {
    "obj_emb.weight": [
      11,
      16
    ],
    "col_emb.weight": [
      6,
      16
    ],
    "state_emb.weight": [
      4,
      16
    ],
    "word_emb.weight": [
      15,
      32
    ],
    "instr.weight": [
      128,
      160
    ],
    "instr.bias": [
      128
    ],
    "conv1.weight": [
      64,
      16,
      3,
      3
    ],
    "conv1.bias": [
      64
    ],
    "film1.weight": [
      128,
      128
    ],
    "film1.bias": [
      128
    ],
    "conv2.weight": [
      64,
      64,
      3,
      3
    ],
    "conv2.bias": [
      64
    ],
    "film2.weight": [
      128,
      128
    ],
    "film2.bias": [
      128
    ],
    "fc.weight": [
      256,
      4096
    ],
    "fc.bias": [
      256
    ],
    "ln.weight": [
      256
    ],
    "ln.bias": [
      256
    ],
    "head.weight": [
      7,
      256
    ],
    "head.bias": [
      7
    ]
  },
  "layers": [
    {
      "name": "cells",
      "computes": "e[n, x, y] = obj_emb.weight[object] + col_emb.weight[color] + state_emb.weight[state]",
      "shape": [
        16,
        8,
        8
      ]
    },
    {
      "name": "instr",
      "computes": "w = concat(word_emb.weight[id_0], ..., word_emb.weight[id_4]); h = relu(instr.weight @ w + instr.bias)",
      "shape": [
        128
      ]
    },
    {
      "name": "block1",
      "computes": "z = conv1(e); (g, b) = split(film1.weight @ h + film1.bias); z = relu(z * (1 + g) + b), g and b per channel",
      "shape": [
        64,
        8,
        8
      ]
    },
    {
      "name": "block2",
      "computes": "z = conv2(z); (g, b) = split(film2.weight @ h + film2.bias); z = relu(z * (1 + g) + b)",
      "shape": [
        64,
        8,
        8
      ]
    },
    {
      "name": "fc",
      "computes": "u = relu(ln(fc.weight @ flatten(z) + fc.bias)), flatten in (channel, x, y) C order, ln = LayerNorm with eps 1e-5",
      "shape": [
        256
      ]
    },
    {
      "name": "head",
      "computes": "logits = head.weight @ u + head.bias",
      "shape": [
        7
      ]
    }
  ],
  "conv": "3x3 cross-correlation as torch.nn.functional.conv2d, stride 1, zero padding 1, with bias",
  "output": "action logits [N, 7]; the action taken is the argmax (greedy, first index on ties)",
  "reference_forward": "forward.py: forward(params, x_int64 [N, 197]) -> float32 logits [N, 7]"
}