darabos commited on
Commit
e792fcf
·
1 Parent(s): 1c50522

Restore PyTorch example to a reasonable condition.

Browse files
lynxkite-app/data/PyTorch demo CHANGED
@@ -11,25 +11,28 @@
11
  "error": null,
12
  "meta": {
13
  "name": "Input: features",
14
- "params": {},
15
- "inputs": {},
16
  "outputs": {
17
  "x": {
 
18
  "name": "x",
19
  "type": {
20
  "type": "tensor"
21
- },
22
- "position": "top"
23
  }
24
  },
25
- "type": "basic",
26
- "sub_nodes": null
27
- }
 
 
28
  },
29
  "position": {
30
  "x": -108.60604658638658,
31
  "y": 63.96065124378427
32
  },
 
 
33
  "parentId": null
34
  },
35
  {
@@ -40,10 +43,13 @@
40
  "params": {},
41
  "display": null,
42
  "error": null,
 
 
43
  "meta": {
44
  "name": "Input: graph edges",
45
- "params": {},
46
  "inputs": {},
 
 
47
  "outputs": {
48
  "edges": {
49
  "name": "edges",
@@ -52,16 +58,16 @@
52
  },
53
  "position": "top"
54
  }
55
- },
56
- "type": "basic",
57
- "sub_nodes": null
58
  }
59
  },
60
  "position": {
61
  "x": 180.7373888617958,
62
  "y": 58.54904654355781
63
  },
64
- "parentId": null
 
 
65
  },
66
  {
67
  "id": "Linear 1",
@@ -74,43 +80,44 @@
74
  "display": null,
75
  "error": null,
76
  "meta": {
77
- "name": "Linear",
78
- "params": {
79
- "output_dim": {
80
- "name": "output_dim",
81
- "default": "same",
82
- "type": {
83
- "type": "<class 'str'>"
84
- }
85
- }
86
- },
87
  "inputs": {
88
  "x": {
89
- "name": "x",
90
  "type": {
91
  "type": "tensor"
92
  },
93
- "position": "bottom"
 
94
  }
95
  },
 
 
96
  "outputs": {
97
  "x": {
98
- "name": "x",
99
  "type": {
100
  "type": "tensor"
101
  },
102
- "position": "top"
 
103
  }
104
  },
105
- "type": "basic",
106
- "sub_nodes": null
 
 
 
 
 
 
 
107
  }
108
  },
109
  "position": {
110
- "x": 56.938816909128036,
111
- "y": -573.5634543506885
112
  },
113
- "parentId": null
 
 
114
  },
115
  {
116
  "id": "Activation 1",
@@ -123,11 +130,30 @@
123
  "display": null,
124
  "error": null,
125
  "meta": {
 
 
 
 
 
 
 
 
 
126
  "name": "Activation",
 
 
 
 
 
 
 
 
 
 
127
  "params": {
128
  "type": {
 
129
  "name": "type",
130
- "default": 1,
131
  "type": {
132
  "enum": [
133
  "ReLU",
@@ -137,34 +163,16 @@
137
  ]
138
  }
139
  }
140
- },
141
- "inputs": {
142
- "x": {
143
- "name": "x",
144
- "type": {
145
- "type": "tensor"
146
- },
147
- "position": "bottom"
148
- }
149
- },
150
- "outputs": {
151
- "x": {
152
- "name": "x",
153
- "type": {
154
- "type": "tensor"
155
- },
156
- "position": "top"
157
- }
158
- },
159
- "type": "basic",
160
- "sub_nodes": null
161
  }
162
  },
163
  "position": {
164
- "x": 84.15324804216073,
165
- "y": -729.2300004316357
166
  },
167
- "parentId": null
 
 
168
  },
169
  {
170
  "id": "Dropout 1",
@@ -177,16 +185,7 @@
177
  "display": null,
178
  "error": null,
179
  "meta": {
180
- "name": "Dropout",
181
- "params": {
182
- "p": {
183
- "name": "p",
184
- "default": 0.5,
185
- "type": {
186
- "type": "<class 'float'>"
187
- }
188
- }
189
- },
190
  "inputs": {
191
  "x": {
192
  "name": "x",
@@ -196,59 +195,34 @@
196
  "position": "bottom"
197
  }
198
  },
199
- "outputs": {
200
- "x": {
201
- "name": "x",
 
202
  "type": {
203
- "type": "tensor"
204
  },
205
- "position": "top"
206
  }
207
  },
208
- "type": "basic",
209
- "sub_nodes": null
210
- }
211
- },
212
- "position": {
213
- "x": 56.938816909128036,
214
- "y": -889.4846386414522
215
- },
216
- "parentId": null
217
- },
218
- {
219
- "id": "Repeat 1",
220
- "type": "area",
221
- "data": {
222
- "title": "Repeat",
223
- "params": {
224
- "times": "3"
225
- },
226
- "display": null,
227
- "error": null,
228
- "meta": {
229
- "name": "Repeat",
230
- "params": {
231
- "times": {
232
- "name": "times",
233
- "default": 1,
234
  "type": {
235
- "type": "<class 'int'>"
236
  }
237
  }
238
- },
239
- "inputs": {},
240
- "outputs": {},
241
- "type": "area",
242
- "sub_nodes": null
243
  }
244
  },
245
  "position": {
246
- "x": -48.6249442834993,
247
- "y": -970.0583599108166
248
  },
 
249
  "parentId": null,
250
- "width": 400,
251
- "height": 600
252
  },
253
  {
254
  "id": "Graph conv 1",
@@ -261,11 +235,21 @@
261
  "display": null,
262
  "error": null,
263
  "meta": {
 
 
 
 
 
 
 
 
 
 
264
  "name": "Graph conv",
265
  "params": {
266
  "type": {
267
  "name": "type",
268
- "default": 1,
269
  "type": {
270
  "enum": [
271
  "GCNConv",
@@ -278,10 +262,10 @@
278
  },
279
  "inputs": {
280
  "x": {
281
- "name": "x",
282
  "type": {
283
  "type": "tensor"
284
  },
 
285
  "position": "bottom"
286
  },
287
  "edges": {
@@ -291,61 +275,17 @@
291
  },
292
  "position": "bottom"
293
  }
294
- },
295
- "outputs": {
296
- "x": {
297
- "name": "x",
298
- "type": {
299
- "type": "tensor"
300
- },
301
- "position": "top"
302
- }
303
- },
304
- "type": "basic",
305
- "sub_nodes": null
306
  }
307
  },
308
  "position": {
309
  "x": 64.08886242755246,
310
  "y": -269.43023573181557
311
  },
 
 
312
  "parentId": null
313
  },
314
- {
315
- "id": "Repeat 2",
316
- "type": "area",
317
- "data": {
318
- "title": "Repeat",
319
- "params": {
320
- "times": "5"
321
- },
322
- "display": null,
323
- "error": null,
324
- "meta": {
325
- "name": "Repeat",
326
- "params": {
327
- "times": {
328
- "name": "times",
329
- "default": 1,
330
- "type": {
331
- "type": "<class 'int'>"
332
- }
333
- }
334
- },
335
- "inputs": {},
336
- "outputs": {},
337
- "type": "area",
338
- "sub_nodes": null
339
- }
340
- },
341
- "position": {
342
- "x": -46.21033706832179,
343
- "y": -326.2712248181098
344
- },
345
- "parentId": null,
346
- "width": 400,
347
- "height": 200
348
- },
349
  {
350
  "id": "Supervised loss 1",
351
  "type": "basic",
@@ -354,19 +294,22 @@
354
  "params": {},
355
  "display": null,
356
  "error": null,
 
 
357
  "meta": {
358
- "name": "Supervised loss",
359
  "params": {},
 
360
  "inputs": {
361
- "x": {
362
- "name": "x",
363
  "type": {
364
  "type": "tensor"
365
  },
366
  "position": "bottom"
367
  },
368
- "y": {
369
- "name": "y",
370
  "type": {
371
  "type": "tensor"
372
  },
@@ -375,22 +318,22 @@
375
  },
376
  "outputs": {
377
  "loss": {
378
- "name": "loss",
379
  "type": {
380
  "type": "tensor"
381
  },
382
- "position": "top"
383
  }
384
- },
385
- "type": "basic",
386
- "sub_nodes": null
387
  }
388
  },
389
  "position": {
390
  "x": 110.53693593362718,
391
  "y": -1123.9976567905628
392
  },
393
- "parentId": null
 
 
394
  },
395
  {
396
  "id": "Input: label 1",
@@ -400,27 +343,30 @@
400
  "params": {},
401
  "display": null,
402
  "error": null,
 
 
403
  "meta": {
404
- "name": "Input: label",
405
- "params": {},
406
  "inputs": {},
407
  "outputs": {
408
  "y": {
409
- "name": "y",
410
  "type": {
411
  "type": "tensor"
412
  },
413
- "position": "top"
 
414
  }
415
  },
 
416
  "type": "basic",
417
- "sub_nodes": null
418
  }
419
  },
420
  "position": {
421
  "x": 666.110498676668,
422
  "y": -898.6721561114967
423
  },
 
 
424
  "parentId": null
425
  },
426
  {
@@ -429,17 +375,23 @@
429
  "data": {
430
  "title": "Optimizer",
431
  "params": {
432
- "type": "AdamW",
433
- "lr": 0.001
434
  },
435
  "display": null,
436
  "error": null,
437
  "meta": {
438
  "name": "Optimizer",
 
439
  "params": {
 
 
 
 
 
 
 
440
  "type": {
441
- "name": "type",
442
- "default": 1,
443
  "type": {
444
  "enum": [
445
  "AdamW",
@@ -450,35 +402,136 @@
450
  "Paged AdamW",
451
  "Galore AdamW"
452
  ]
453
- }
454
- },
455
- "lr": {
456
- "name": "lr",
457
- "default": 0.001,
458
- "type": {
459
- "type": "<class 'float'>"
460
- }
461
  }
462
  },
463
  "inputs": {
464
  "loss": {
 
 
 
465
  "name": "loss",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  "type": {
467
  "type": "tensor"
468
  },
469
  "position": "bottom"
470
  }
471
  },
472
- "outputs": {},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  "type": "basic",
474
- "sub_nodes": null
 
 
 
 
 
 
 
 
 
475
  }
476
  },
477
  "position": {
478
- "x": 165.28398260528976,
479
- "y": -1338.6254108128633
480
  },
481
- "parentId": null
 
482
  }
483
  ],
484
  "edges": [
@@ -537,6 +590,34 @@
537
  "target": "Optimizer 1",
538
  "sourceHandle": "loss",
539
  "targetHandle": "loss"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
  ]
542
  }
 
11
  "error": null,
12
  "meta": {
13
  "name": "Input: features",
14
+ "type": "basic",
 
15
  "outputs": {
16
  "x": {
17
+ "position": "top",
18
  "name": "x",
19
  "type": {
20
  "type": "tensor"
21
+ }
 
22
  }
23
  },
24
+ "params": {},
25
+ "inputs": {}
26
+ },
27
+ "collapsed": true,
28
+ "__execution_delay": null
29
  },
30
  "position": {
31
  "x": -108.60604658638658,
32
  "y": 63.96065124378427
33
  },
34
+ "width": 200.0,
35
+ "height": 200.0,
36
  "parentId": null
37
  },
38
  {
 
43
  "params": {},
44
  "display": null,
45
  "error": null,
46
+ "__execution_delay": null,
47
+ "collapsed": true,
48
  "meta": {
49
  "name": "Input: graph edges",
 
50
  "inputs": {},
51
+ "params": {},
52
+ "type": "basic",
53
  "outputs": {
54
  "edges": {
55
  "name": "edges",
 
58
  },
59
  "position": "top"
60
  }
61
+ }
 
 
62
  }
63
  },
64
  "position": {
65
  "x": 180.7373888617958,
66
  "y": 58.54904654355781
67
  },
68
+ "width": 200.0,
69
+ "parentId": null,
70
+ "height": 200.0
71
  },
72
  {
73
  "id": "Linear 1",
 
80
  "display": null,
81
  "error": null,
82
  "meta": {
 
 
 
 
 
 
 
 
 
 
83
  "inputs": {
84
  "x": {
 
85
  "type": {
86
  "type": "tensor"
87
  },
88
+ "position": "bottom",
89
+ "name": "x"
90
  }
91
  },
92
+ "type": "basic",
93
+ "name": "Linear",
94
  "outputs": {
95
  "x": {
 
96
  "type": {
97
  "type": "tensor"
98
  },
99
+ "position": "top",
100
+ "name": "x"
101
  }
102
  },
103
+ "params": {
104
+ "output_dim": {
105
+ "name": "output_dim",
106
+ "type": {
107
+ "type": "<class 'str'>"
108
+ },
109
+ "default": "same"
110
+ }
111
+ }
112
  }
113
  },
114
  "position": {
115
+ "x": 78.37881963123723,
116
+ "y": -528.3012263817914
117
  },
118
+ "parentId": null,
119
+ "width": 204.0,
120
+ "height": 140.0
121
  },
122
  {
123
  "id": "Activation 1",
 
130
  "display": null,
131
  "error": null,
132
  "meta": {
133
+ "outputs": {
134
+ "x": {
135
+ "position": "top",
136
+ "type": {
137
+ "type": "tensor"
138
+ },
139
+ "name": "x"
140
+ }
141
+ },
142
  "name": "Activation",
143
+ "type": "basic",
144
+ "inputs": {
145
+ "x": {
146
+ "position": "bottom",
147
+ "name": "x",
148
+ "type": {
149
+ "type": "tensor"
150
+ }
151
+ }
152
+ },
153
  "params": {
154
  "type": {
155
+ "default": "OptionsFor_type.ReLU",
156
  "name": "type",
 
157
  "type": {
158
  "enum": [
159
  "ReLU",
 
163
  ]
164
  }
165
  }
166
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
  },
169
  "position": {
170
+ "x": 98.44658319023353,
171
+ "y": -741.1411130550297
172
  },
173
+ "height": 154.0,
174
+ "parentId": null,
175
+ "width": 173.0
176
  },
177
  {
178
  "id": "Dropout 1",
 
185
  "display": null,
186
  "error": null,
187
  "meta": {
188
+ "type": "basic",
 
 
 
 
 
 
 
 
 
189
  "inputs": {
190
  "x": {
191
  "name": "x",
 
195
  "position": "bottom"
196
  }
197
  },
198
+ "name": "Dropout",
199
+ "params": {
200
+ "p": {
201
+ "default": 0.5,
202
  "type": {
203
+ "type": "<class 'float'>"
204
  },
205
+ "name": "p"
206
  }
207
  },
208
+ "outputs": {
209
+ "x": {
210
+ "position": "top",
211
+ "name": "x",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  "type": {
213
+ "type": "tensor"
214
  }
215
  }
216
+ }
 
 
 
 
217
  }
218
  },
219
  "position": {
220
+ "x": 73.61437458187964,
221
+ "y": -929.9824215609918
222
  },
223
+ "width": 207.0,
224
  "parentId": null,
225
+ "height": 159.0
 
226
  },
227
  {
228
  "id": "Graph conv 1",
 
235
  "display": null,
236
  "error": null,
237
  "meta": {
238
+ "outputs": {
239
+ "x": {
240
+ "type": {
241
+ "type": "tensor"
242
+ },
243
+ "name": "x",
244
+ "position": "top"
245
+ }
246
+ },
247
+ "type": "basic",
248
  "name": "Graph conv",
249
  "params": {
250
  "type": {
251
  "name": "type",
252
+ "default": "OptionsFor_type.GCNConv",
253
  "type": {
254
  "enum": [
255
  "GCNConv",
 
262
  },
263
  "inputs": {
264
  "x": {
 
265
  "type": {
266
  "type": "tensor"
267
  },
268
+ "name": "x",
269
  "position": "bottom"
270
  },
271
  "edges": {
 
275
  },
276
  "position": "bottom"
277
  }
278
+ }
 
 
 
 
 
 
 
 
 
 
 
279
  }
280
  },
281
  "position": {
282
  "x": 64.08886242755246,
283
  "y": -269.43023573181557
284
  },
285
+ "height": 200.0,
286
+ "width": 200.0,
287
  "parentId": null
288
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  {
290
  "id": "Supervised loss 1",
291
  "type": "basic",
 
294
  "params": {},
295
  "display": null,
296
  "error": null,
297
+ "collapsed": true,
298
+ "__execution_delay": null,
299
  "meta": {
300
+ "type": "basic",
301
  "params": {},
302
+ "name": "Supervised loss",
303
  "inputs": {
304
+ "y": {
305
+ "name": "y",
306
  "type": {
307
  "type": "tensor"
308
  },
309
  "position": "bottom"
310
  },
311
+ "x": {
312
+ "name": "x",
313
  "type": {
314
  "type": "tensor"
315
  },
 
318
  },
319
  "outputs": {
320
  "loss": {
321
+ "position": "top",
322
  "type": {
323
  "type": "tensor"
324
  },
325
+ "name": "loss"
326
  }
327
+ }
 
 
328
  }
329
  },
330
  "position": {
331
  "x": 110.53693593362718,
332
  "y": -1123.9976567905628
333
  },
334
+ "parentId": null,
335
+ "height": 80.0,
336
+ "width": 204.0
337
  },
338
  {
339
  "id": "Input: label 1",
 
343
  "params": {},
344
  "display": null,
345
  "error": null,
346
+ "collapsed": true,
347
+ "__execution_delay": null,
348
  "meta": {
 
 
349
  "inputs": {},
350
  "outputs": {
351
  "y": {
 
352
  "type": {
353
  "type": "tensor"
354
  },
355
+ "position": "top",
356
+ "name": "y"
357
  }
358
  },
359
+ "name": "Input: label",
360
  "type": "basic",
361
+ "params": {}
362
  }
363
  },
364
  "position": {
365
  "x": 666.110498676668,
366
  "y": -898.6721561114967
367
  },
368
+ "width": 200.0,
369
+ "height": 73.0,
370
  "parentId": null
371
  },
372
  {
 
375
  "data": {
376
  "title": "Optimizer",
377
  "params": {
378
+ "lr": 0.001,
379
+ "type": "AdamW"
380
  },
381
  "display": null,
382
  "error": null,
383
  "meta": {
384
  "name": "Optimizer",
385
+ "outputs": {},
386
  "params": {
387
+ "lr": {
388
+ "default": 0.001,
389
+ "name": "lr",
390
+ "type": {
391
+ "type": "<class 'float'>"
392
+ }
393
+ },
394
  "type": {
 
 
395
  "type": {
396
  "enum": [
397
  "AdamW",
 
402
  "Paged AdamW",
403
  "Galore AdamW"
404
  ]
405
+ },
406
+ "name": "type",
407
+ "default": "OptionsFor_type.AdamW"
 
 
 
 
 
408
  }
409
  },
410
  "inputs": {
411
  "loss": {
412
+ "type": {
413
+ "type": "tensor"
414
+ },
415
  "name": "loss",
416
+ "position": "bottom"
417
+ }
418
+ },
419
+ "type": "basic"
420
+ }
421
+ },
422
+ "position": {
423
+ "x": 115.25730958703494,
424
+ "y": -1431.5320892753364
425
+ },
426
+ "width": 200.0,
427
+ "height": 233.0,
428
+ "parentId": null
429
+ },
430
+ {
431
+ "id": "Repeat 3",
432
+ "type": "basic",
433
+ "data": {
434
+ "title": "Repeat",
435
+ "params": {
436
+ "times": 1.0
437
+ },
438
+ "display": null,
439
+ "error": null,
440
+ "meta": {
441
+ "type": "basic",
442
+ "position": {
443
+ "y": 340.0,
444
+ "x": 371.0
445
+ },
446
+ "outputs": {
447
+ "output": {
448
+ "name": "output",
449
  "type": {
450
  "type": "tensor"
451
  },
452
  "position": "bottom"
453
  }
454
  },
455
+ "name": "Repeat",
456
+ "params": {
457
+ "times": {
458
+ "name": "times",
459
+ "default": 1.0,
460
+ "type": {
461
+ "type": "<class 'int'>"
462
+ }
463
+ }
464
+ },
465
+ "inputs": {
466
+ "input": {
467
+ "type": {
468
+ "type": "tensor"
469
+ },
470
+ "position": "top",
471
+ "name": "input"
472
+ }
473
+ }
474
+ }
475
+ },
476
+ "position": {
477
+ "x": -245.1288628776232,
478
+ "y": -276.90661040974317
479
+ },
480
+ "width": 200.0,
481
+ "height": 200.0
482
+ },
483
+ {
484
+ "id": "Repeat 1",
485
+ "type": "basic",
486
+ "data": {
487
+ "title": "Repeat",
488
+ "params": {
489
+ "times": 1.0
490
+ },
491
+ "display": null,
492
+ "error": null,
493
+ "meta": {
494
+ "outputs": {
495
+ "output": {
496
+ "position": "bottom",
497
+ "type": {
498
+ "type": "tensor"
499
+ },
500
+ "name": "output"
501
+ }
502
+ },
503
+ "params": {
504
+ "times": {
505
+ "default": 1.0,
506
+ "type": {
507
+ "type": "<class 'int'>"
508
+ },
509
+ "name": "times"
510
+ }
511
+ },
512
+ "position": {
513
+ "x": 387.0,
514
+ "y": 337.0
515
+ },
516
  "type": "basic",
517
+ "name": "Repeat",
518
+ "inputs": {
519
+ "input": {
520
+ "name": "input",
521
+ "position": "top",
522
+ "type": {
523
+ "type": "tensor"
524
+ }
525
+ }
526
+ }
527
  }
528
  },
529
  "position": {
530
+ "x": -258.0088683218416,
531
+ "y": -737.3822225246788
532
  },
533
+ "width": 200.0,
534
+ "height": 200.0
535
  }
536
  ],
537
  "edges": [
 
590
  "target": "Optimizer 1",
591
  "sourceHandle": "loss",
592
  "targetHandle": "loss"
593
+ },
594
+ {
595
+ "id": "Graph conv 1 Repeat 3",
596
+ "source": "Graph conv 1",
597
+ "target": "Repeat 3",
598
+ "sourceHandle": "x",
599
+ "targetHandle": "input"
600
+ },
601
+ {
602
+ "id": "Repeat 3 Graph conv 1",
603
+ "source": "Repeat 3",
604
+ "target": "Graph conv 1",
605
+ "sourceHandle": "output",
606
+ "targetHandle": "x"
607
+ },
608
+ {
609
+ "id": "Dropout 1 Repeat 1",
610
+ "source": "Dropout 1",
611
+ "target": "Repeat 1",
612
+ "sourceHandle": "x",
613
+ "targetHandle": "input"
614
+ },
615
+ {
616
+ "id": "Repeat 1 Linear 1",
617
+ "source": "Repeat 1",
618
+ "target": "Linear 1",
619
+ "sourceHandle": "output",
620
+ "targetHandle": "x"
621
  }
622
  ]
623
  }
lynxkite-graph-analytics/src/lynxkite_plugins/graph_analytics/pytorch_model_ops.py CHANGED
@@ -66,4 +66,10 @@ reg(
66
  ],
67
  )
68
 
69
- ops.register_area(ENV, "Repeat", params=[ops.Parameter.basic("times", 1, int)])
 
 
 
 
 
 
 
66
  ],
67
  )
68
 
69
+ ops.register_passive_op(
70
+ ENV,
71
+ "Repeat",
72
+ inputs=[ops.Input(name="input", position="top", type="tensor")],
73
+ outputs=[ops.Output(name="output", position="bottom", type="tensor")],
74
+ params=[ops.Parameter.basic("times", 1, int)],
75
+ )