darabos commited on
Commit
f41635e
·
1 Parent(s): a45c4a9

Non-blocking training.

Browse files
examples/Model definition CHANGED
@@ -1,19 +1,5 @@
1
  {
2
  "edges": [
3
- {
4
- "id": "Linear 2 Activation 1",
5
- "source": "Linear 2",
6
- "sourceHandle": "output",
7
- "target": "Activation 1",
8
- "targetHandle": "x"
9
- },
10
- {
11
- "id": "Input: tensor 1 Linear 2",
12
- "source": "Input: tensor 1",
13
- "sourceHandle": "x",
14
- "target": "Linear 2",
15
- "targetHandle": "x"
16
- },
17
  {
18
  "id": "MSE loss 2 Optimizer 2",
19
  "source": "MSE loss 2",
@@ -43,10 +29,24 @@
43
  "targetHandle": "input"
44
  },
45
  {
46
- "id": "Repeat 1 Linear 2",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  "source": "Repeat 1",
48
  "sourceHandle": "output",
49
- "target": "Linear 2",
50
  "targetHandle": "x"
51
  }
52
  ],
@@ -114,60 +114,6 @@
114
  "type": "basic",
115
  "width": 232.0
116
  },
117
- {
118
- "data": {
119
- "__execution_delay": 0.0,
120
- "collapsed": null,
121
- "display": null,
122
- "error": null,
123
- "input_metadata": null,
124
- "meta": {
125
- "inputs": {
126
- "x": {
127
- "name": "x",
128
- "position": "bottom",
129
- "type": {
130
- "type": "<class 'inspect._empty'>"
131
- }
132
- }
133
- },
134
- "name": "Linear",
135
- "outputs": {
136
- "output": {
137
- "name": "output",
138
- "position": "top",
139
- "type": {
140
- "type": "None"
141
- }
142
- }
143
- },
144
- "params": {
145
- "output_dim": {
146
- "default": "",
147
- "name": "output_dim",
148
- "type": {
149
- "type": "<class 'int'>"
150
- }
151
- }
152
- },
153
- "type": "basic"
154
- },
155
- "params": {
156
- "output_dim": "4"
157
- },
158
- "status": "planned",
159
- "title": "Linear"
160
- },
161
- "dragHandle": ".bg-primary",
162
- "height": 200.0,
163
- "id": "Linear 2",
164
- "position": {
165
- "x": 92.32755761444682,
166
- "y": 20.626371289630676
167
- },
168
- "type": "basic",
169
- "width": 200.0
170
- },
171
  {
172
  "data": {
173
  "__execution_delay": 0.0,
@@ -242,8 +188,8 @@
242
  "inputs": {},
243
  "name": "Input: tensor",
244
  "outputs": {
245
- "output": {
246
- "name": "output",
247
  "position": "top",
248
  "type": {
249
  "type": "tensor"
@@ -292,8 +238,8 @@
292
  "inputs": {},
293
  "name": "Input: tensor",
294
  "outputs": {
295
- "output": {
296
- "name": "output",
297
  "position": "top",
298
  "type": {
299
  "type": "tensor"
@@ -383,6 +329,130 @@
383
  },
384
  "type": "basic",
385
  "width": 200.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  }
387
  ]
388
  }
 
1
  {
2
  "edges": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  {
4
  "id": "MSE loss 2 Optimizer 2",
5
  "source": "MSE loss 2",
 
29
  "targetHandle": "input"
30
  },
31
  {
32
+ "id": "Input: tensor 1 Linear 1",
33
+ "source": "Input: tensor 1",
34
+ "sourceHandle": "x",
35
+ "target": "Linear 1",
36
+ "targetHandle": "x"
37
+ },
38
+ {
39
+ "id": "Linear 1 Activation 1",
40
+ "source": "Linear 1",
41
+ "sourceHandle": "output",
42
+ "target": "Activation 1",
43
+ "targetHandle": "x"
44
+ },
45
+ {
46
+ "id": "Repeat 1 Linear 1",
47
  "source": "Repeat 1",
48
  "sourceHandle": "output",
49
+ "target": "Linear 1",
50
  "targetHandle": "x"
51
  }
52
  ],
 
114
  "type": "basic",
115
  "width": 232.0
116
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  {
118
  "data": {
119
  "__execution_delay": 0.0,
 
188
  "inputs": {},
189
  "name": "Input: tensor",
190
  "outputs": {
191
+ "x": {
192
+ "name": "x",
193
  "position": "top",
194
  "type": {
195
  "type": "tensor"
 
238
  "inputs": {},
239
  "name": "Input: tensor",
240
  "outputs": {
241
+ "x": {
242
+ "name": "x",
243
  "position": "top",
244
  "type": {
245
  "type": "tensor"
 
329
  },
330
  "type": "basic",
331
  "width": 200.0
332
+ },
333
+ {
334
+ "data": {
335
+ "__execution_delay": 0.0,
336
+ "collapsed": null,
337
+ "display": null,
338
+ "error": null,
339
+ "input_metadata": null,
340
+ "meta": {
341
+ "inputs": {
342
+ "input": {
343
+ "name": "input",
344
+ "position": "top",
345
+ "type": {
346
+ "type": "tensor"
347
+ }
348
+ }
349
+ },
350
+ "name": "Repeat",
351
+ "outputs": {
352
+ "output": {
353
+ "name": "output",
354
+ "position": "bottom",
355
+ "type": {
356
+ "type": "tensor"
357
+ }
358
+ }
359
+ },
360
+ "params": {
361
+ "same_weights": {
362
+ "default": false,
363
+ "name": "same_weights",
364
+ "type": {
365
+ "type": "<class 'bool'>"
366
+ }
367
+ },
368
+ "times": {
369
+ "default": 1.0,
370
+ "name": "times",
371
+ "type": {
372
+ "type": "<class 'int'>"
373
+ }
374
+ }
375
+ },
376
+ "position": {
377
+ "x": 487.0,
378
+ "y": 443.0
379
+ },
380
+ "type": "basic"
381
+ },
382
+ "params": {
383
+ "same_weights": false,
384
+ "times": "2"
385
+ },
386
+ "status": "planned",
387
+ "title": "Repeat"
388
+ },
389
+ "dragHandle": ".bg-primary",
390
+ "height": 200.0,
391
+ "id": "Repeat 1",
392
+ "position": {
393
+ "x": -210.0,
394
+ "y": -135.0
395
+ },
396
+ "type": "basic",
397
+ "width": 200.0
398
+ },
399
+ {
400
+ "data": {
401
+ "__execution_delay": 0.0,
402
+ "collapsed": null,
403
+ "display": null,
404
+ "error": null,
405
+ "input_metadata": null,
406
+ "meta": {
407
+ "inputs": {
408
+ "x": {
409
+ "name": "x",
410
+ "position": "bottom",
411
+ "type": {
412
+ "type": "<class 'inspect._empty'>"
413
+ }
414
+ }
415
+ },
416
+ "name": "Linear",
417
+ "outputs": {
418
+ "output": {
419
+ "name": "output",
420
+ "position": "top",
421
+ "type": {
422
+ "type": "None"
423
+ }
424
+ }
425
+ },
426
+ "params": {
427
+ "output_dim": {
428
+ "default": 1024.0,
429
+ "name": "output_dim",
430
+ "type": {
431
+ "type": "<class 'int'>"
432
+ }
433
+ }
434
+ },
435
+ "position": {
436
+ "x": 359.0,
437
+ "y": 310.0
438
+ },
439
+ "type": "basic"
440
+ },
441
+ "params": {
442
+ "output_dim": "4"
443
+ },
444
+ "status": "planned",
445
+ "title": "Linear"
446
+ },
447
+ "dragHandle": ".bg-primary",
448
+ "height": 200.0,
449
+ "id": "Linear 1",
450
+ "position": {
451
+ "x": 88.83370222907377,
452
+ "y": 48.642890099180136
453
+ },
454
+ "type": "basic",
455
+ "width": 200.0
456
  }
457
  ]
458
  }
examples/Model use CHANGED
@@ -575,58 +575,58 @@
575
  "columns": [
576
  "x",
577
  "y",
578
- "predicted"
579
  ],
580
  "data": [
581
  [
582
- "[0.94559073 0.65736622 0.25761551 0.48553199]",
583
- "[1.94559073 1.65736628 1.25761557 1.48553205]",
584
- "[1.5948047637939453, 1.619612693786621, 1.5269112586975098, -0.008817584253847599]"
585
  ],
586
  [
587
- "[0.47856545 0.46267092 0.6376707 0.84747767]",
588
- "[1.47856545 1.46267092 1.63767076 1.84747767]",
589
- "[1.5928349494934082, 1.6176562309265137, 1.52553391456604, -0.008808750659227371]"
590
  ],
591
  [
592
- "[0.59492421 0.90274489 0.38069052 0.46101224]",
593
- "[1.59492421 1.90274489 1.38069057 1.46101224]",
594
- "[1.5592631101608276, 1.5841729640960693, 1.5020174980163574, -0.008660631254315376]"
595
  ],
596
  [
597
- "[0.12858278 0.09930819 0.83222693 0.72485673]",
598
- "[1.12858272 1.09930825 1.83222699 1.72485673]",
599
- "[1.469609260559082, 1.4953691959381104, 1.4395854473114014, -0.00825517252087593]"
600
  ],
601
  [
602
- "[0.94516498 0.08422136 0.5608117 0.07652664]",
603
- "[1.94516492 1.08422136 1.56081176 1.07652664]",
604
- "[1.5648787021636963, 1.5899150371551514, 1.5060429573059082, -0.008683123625814915]"
605
  ],
606
  [
607
- "[0.54914117 0.03810108 0.87531954 0.73044223]",
608
- "[1.54914117 1.03810108 1.87531948 1.73044229]",
609
- "[1.6262837648391724, 1.650843620300293, 1.548863410949707, -0.00895910244435072]"
610
  ],
611
  [
612
- "[0.94221359 0.57740951 0.98649532 0.40934443]",
613
- "[1.94221354 1.57740951 1.98649526 1.40934443]",
614
- "[1.8493703603744507, 1.8721930980682373, 1.704444169998169, -0.009961890056729317]"
615
  ],
616
  [
617
- "[0.80654246 0.08253473 0.74478531 0.71257162]",
618
- "[1.8065424 1.08253479 1.74478531 1.71257162]",
619
- "[1.672502040863037, 1.6967051029205322, 1.5810983180999756, -0.009166811592876911]"
620
  ],
621
  [
622
- "[0.50272274 0.54912758 0.17663097 0.79070699]",
623
- "[1.50272274 1.54912758 1.17663097 1.79070699]",
624
- "[1.4309396743774414, 1.4570224285125732, 1.4126286506652832, -0.008081027306616306]"
625
  ],
626
  [
627
  "[0.34084332 0.73018837 0.54168713 0.91440833]",
628
  "[1.34084332 1.73018837 1.54168713 1.91440833]",
629
- "[1.5581963062286377, 1.5832865238189697, 1.5013742446899414, -0.008653069846332073]"
630
  ]
631
  ]
632
  },
@@ -693,12 +693,12 @@
693
  "[1.48959708 1.48549271 1.32688856 1.35667706]"
694
  ],
695
  [
696
- "[0.04508126 0.76880038 0.80721325 0.62542385]",
697
- "[1.04508126 1.76880038 1.80721331 1.62542391]"
698
  ],
699
  [
700
- "[0.19908059 0.17570406 0.51475513 0.1893943 ]",
701
- "[1.19908059 1.175704 1.51475513 1.18939424]"
702
  ],
703
  [
704
  "[0.40167677 0.25953674 0.9407078 0.76308483]",
@@ -736,10 +736,6 @@
736
  "[0.68062544 0.98093534 0.14778823 0.53244978]",
737
  "[1.68062544 1.98093534 1.14778829 1.53244972]"
738
  ],
739
- [
740
- "[0.31518555 0.49643308 0.11509258 0.95458382]",
741
- "[1.31518555 1.49643302 1.11509252 1.95458388]"
742
- ],
743
  [
744
  "[0.79121011 0.54161114 0.69369799 0.1520769 ]",
745
  "[1.79121017 1.54161119 1.69369793 1.15207696]"
@@ -753,8 +749,8 @@
753
  "[1.23942459 1.90487361 1.69337189 1.65089428]"
754
  ],
755
  [
756
- "[0.26661873 0.45946234 0.13510543 0.81294441]",
757
- "[1.26661873 1.4594624 1.13510537 1.81294441]"
758
  ],
759
  [
760
  "[0.30754459 0.77694583 0.09278506 0.38326019]",
@@ -780,6 +776,10 @@
780
  "[0.78956431 0.87284744 0.06880784 0.03455889]",
781
  "[1.78956437 1.87284744 1.06880784 1.03455889]"
782
  ],
 
 
 
 
783
  [
784
  "[0.00497234 0.39319336 0.57054168 0.75150961]",
785
  "[1.00497234 1.39319336 1.57054162 1.75150967]"
@@ -845,16 +845,8 @@
845
  "[1.95928192 1.84273899 1.7151463 1.38619852]"
846
  ],
847
  [
848
- "[0.32565445 0.90939188 0.07488042 0.13730896]",
849
- "[1.32565451 1.90939188 1.07488036 1.13730896]"
850
- ],
851
- [
852
- "[0.9829582 0.59269661 0.40120947 0.95487177]",
853
- "[1.9829582 1.59269667 1.40120947 1.95487177]"
854
- ],
855
- [
856
- "[0.79905868 0.89367443 0.75429088 0.3190186 ]",
857
- "[1.79905868 1.89367437 1.75429082 1.3190186 ]"
858
  ],
859
  [
860
  "[0.67418337 0.79634351 0.23229051 0.71345252]",
@@ -869,12 +861,12 @@
869
  "[1.81788456 1.58174157 1.29376316 1.79712534]"
870
  ],
871
  [
872
- "[0.60075855 0.12234765 0.00614399 0.30560958]",
873
- "[1.60075855 1.12234759 1.00614405 1.30560958]"
874
  ],
875
  [
876
- "[0.39147133 0.29854035 0.84663737 0.58175623]",
877
- "[1.39147139 1.29854035 1.84663737 1.58175623]"
878
  ],
879
  [
880
  "[0.02162331 0.81861657 0.92468154 0.07808572]",
@@ -904,6 +896,10 @@
904
  "[0.60609657 0.96257663 0.19292736 0.95702219]",
905
  "[1.60609651 1.96257663 1.19292736 1.95702219]"
906
  ],
 
 
 
 
907
  [
908
  "[0.70167565 0.26930219 0.5660674 0.61194974]",
909
  "[1.70167565 1.26930213 1.56606746 1.61194968]"
@@ -912,6 +908,10 @@
912
  "[0.76933283 0.86241865 0.44114518 0.65644735]",
913
  "[1.76933289 1.86241865 1.44114518 1.65644741]"
914
  ],
 
 
 
 
915
  [
916
  "[0.15064228 0.03198934 0.25754827 0.51484001]",
917
  "[1.15064228 1.03198934 1.25754833 1.51484001]"
@@ -949,13 +949,17 @@
949
  "[1.40234613 1.54987347 1.49542785 1.5415318 ]"
950
  ],
951
  [
952
- "[0.80893755 0.92237449 0.88346356 0.93164903]",
953
- "[1.80893755 1.92237449 1.88346362 1.93164897]"
954
  ],
955
  [
956
  "[0.72470158 0.4940322 0.41027349 0.89364016]",
957
  "[1.72470164 1.49403214 1.41027355 1.89364016]"
958
  ],
 
 
 
 
959
  [
960
  "[0.49584109 0.80599248 0.07096875 0.75872749]",
961
  "[1.49584103 1.80599248 1.07096875 1.75872755]"
@@ -976,10 +980,6 @@
976
  "[0.68094063 0.45189077 0.22661722 0.37354094]",
977
  "[1.68094063 1.45189071 1.22661722 1.37354088]"
978
  ],
979
- [
980
- "[0.43681622 0.74680805 0.83598751 0.12414402]",
981
- "[1.43681622 1.74680805 1.83598757 1.12414408]"
982
- ],
983
  [
984
  "[0.47870928 0.17129105 0.27300501 0.20634609]",
985
  "[1.47870922 1.17129111 1.27300501 1.20634604]"
@@ -1000,7 +1000,7 @@
1000
  }
1001
  },
1002
  "other": {
1003
- "model": "ModelConfig(model=Sequential(\n (0) - Identity(): Input__tensor_1_x -> START_Repeat_1_output\n (1) - Linear(in_features=4, out_features=4, bias=True): START_Repeat_1_output -> Linear_2_output\n (2) - <function leaky_relu at 0x75e660938220>: Linear_2_output -> Activation_1_output\n (3) - Identity(): Activation_1_output -> START_Repeat_1_output\n (4) - Linear(in_features=4, out_features=4, bias=True): START_Repeat_1_output -> Linear_2_output\n (5) - <function leaky_relu at 0x75e660938220>: Linear_2_output -> Activation_1_output\n (6) - Identity(): Activation_1_output -> START_Repeat_1_output\n (7) - Linear(in_features=4, out_features=4, bias=True): START_Repeat_1_output -> Linear_2_output\n (8) - <function leaky_relu at 0x75e660938220>: Linear_2_output -> Activation_1_output\n (9) - Identity(): Activation_1_output -> END_Repeat_1_output\n (10) - Identity(): END_Repeat_1_output -> END_Repeat_1_output\n), model_inputs=['Input__tensor_1_x'], model_outputs=['END_Repeat_1_output'], loss_inputs=['Input__tensor_3_x', 'END_Repeat_1_output'], loss=Sequential(\n (0) - <function mse_loss at 0x75e660939d00>: END_Repeat_1_output, Input__tensor_3_x -> MSE_loss_2_output\n (1) - Identity(): MSE_loss_2_output -> loss\n), optimizer=SGD (\nParameter Group 0\n dampening: 0\n differentiable: False\n foreach: None\n fused: None\n lr: 0.1\n maximize: False\n momentum: 0\n nesterov: False\n weight_decay: 0\n), source_workspace=None, trained=True)"
1004
  },
1005
  "relations": []
1006
  },
@@ -1016,7 +1016,7 @@
1016
  },
1017
  "df_test": {
1018
  "columns": [
1019
- "predicted",
1020
  "x",
1021
  "y"
1022
  ]
@@ -1035,8 +1035,8 @@
1035
  "Input__tensor_1_x"
1036
  ],
1037
  "loss_inputs": [
1038
- "Input__tensor_3_x",
1039
- "END_Repeat_1_output"
1040
  ],
1041
  "outputs": [
1042
  "END_Repeat_1_output"
@@ -1210,8 +1210,8 @@
1210
  "Input__tensor_1_x"
1211
  ],
1212
  "loss_inputs": [
1213
- "Input__tensor_3_x",
1214
- "END_Repeat_1_output"
1215
  ],
1216
  "outputs": [
1217
  "END_Repeat_1_output"
@@ -1270,7 +1270,7 @@
1270
  "type": "basic"
1271
  },
1272
  "params": {
1273
- "epochs": "110",
1274
  "input_mapping": "{\"map\":{\"Input__tensor_1_x\":{\"df\":\"df_train\",\"column\":\"x\"},\"Input__tensor_3_x\":{\"df\":\"df_train\",\"column\":\"y\"}}}",
1275
  "model_name": "model"
1276
  },
@@ -1322,8 +1322,8 @@
1322
  "Input__tensor_1_x"
1323
  ],
1324
  "loss_inputs": [
1325
- "Input__tensor_3_x",
1326
- "END_Repeat_1_output"
1327
  ],
1328
  "outputs": [
1329
  "END_Repeat_1_output"
@@ -1384,13 +1384,13 @@
1384
  "params": {
1385
  "input_mapping": "{\"map\":{\"Input__tensor_1_x\":{\"df\":\"df_test\",\"column\":\"x\"}}}",
1386
  "model_name": "model",
1387
- "output_mapping": "{\"map\":{\"END_Repeat_1_output\":{\"df\":\"df_test\",\"column\":\"predicted\"}}}"
1388
  },
1389
  "status": "done",
1390
  "title": "Model inference"
1391
  },
1392
  "dragHandle": ".bg-primary",
1393
- "height": 893.0,
1394
  "id": "Model inference 1",
1395
  "position": {
1396
  "x": 2181.718373860645,
 
575
  "columns": [
576
  "x",
577
  "y",
578
+ "pred"
579
  ],
580
  "data": [
581
  [
582
+ "[0.19908059 0.17570406 0.51475513 0.1893943 ]",
583
+ "[1.19908059 1.175704 1.51475513 1.18939424]",
584
+ "[1.560641884803772, 1.5941988229751587, 1.5775359869003296, 1.4935821294784546]"
585
  ],
586
  [
587
+ "[0.43681622 0.74680805 0.83598751 0.12414402]",
588
+ "[1.43681622 1.74680805 1.83598757 1.12414408]",
589
+ "[1.5766589641571045, 1.7117265462875366, 1.7645087242126465, 1.3384637832641602]"
590
  ],
591
  [
592
+ "[0.9829582 0.59269661 0.40120947 0.95487177]",
593
+ "[1.9829582 1.59269667 1.40120947 1.95487177]",
594
+ "[1.5375217199325562, 1.4159281253814697, 1.2972962856292725, 1.7269455194473267]"
595
  ],
596
  [
597
+ "[0.32565445 0.90939188 0.07488042 0.13730896]",
598
+ "[1.32565451 1.90939188 1.07488036 1.13730896]",
599
+ "[1.562728762626648, 1.6061222553253174, 1.597141146659851, 1.4772177934646606]"
600
  ],
601
  [
602
+ "[0.31518555 0.49643308 0.11509258 0.95458382]",
603
+ "[1.31518555 1.49643302 1.11509252 1.95458388]",
604
+ "[1.528311848640442, 1.3380011320114136, 1.171952247619629, 1.8305948972702026]"
605
  ],
606
  [
607
+ "[0.79905868 0.89367443 0.75429088 0.3190186 ]",
608
+ "[1.79905868 1.89367437 1.75429082 1.3190186 ]",
609
+ "[1.5757312774658203, 1.7105278968811035, 1.7636661529541016, 1.3394038677215576]"
610
  ],
611
  [
612
+ "[0.80893755 0.92237449 0.88346356 0.93164903]",
613
+ "[1.80893755 1.92237449 1.88346362 1.93164897]",
614
+ "[1.562132716178894, 1.6031286716461182, 1.593322992324829, 1.4810831546783447]"
615
  ],
616
  [
617
+ "[0.26661873 0.45946234 0.13510543 0.81294441]",
618
+ "[1.26661873 1.4594624 1.13510537 1.81294441]",
619
+ "[1.533058762550354, 1.3753284215927124, 1.230975866317749, 1.7815138101577759]"
620
  ],
621
  [
622
+ "[0.39147133 0.29854035 0.84663737 0.58175623]",
623
+ "[1.39147139 1.29854035 1.84663737 1.58175623]",
624
+ "[1.5607244968414307, 1.5942375659942627, 1.5779708623886108, 1.4935153722763062]"
625
  ],
626
  [
627
  "[0.34084332 0.73018837 0.54168713 0.91440833]",
628
  "[1.34084332 1.73018837 1.54168713 1.91440833]",
629
+ "[1.5488454103469849, 1.4963982105255127, 1.422922968864441, 1.622254490852356]"
630
  ]
631
  ]
632
  },
 
693
  "[1.48959708 1.48549271 1.32688856 1.35667706]"
694
  ],
695
  [
696
+ "[0.50272274 0.54912758 0.17663097 0.79070699]",
697
+ "[1.50272274 1.54912758 1.17663097 1.79070699]"
698
  ],
699
  [
700
+ "[0.04508126 0.76880038 0.80721325 0.62542385]",
701
+ "[1.04508126 1.76880038 1.80721331 1.62542391]"
702
  ],
703
  [
704
  "[0.40167677 0.25953674 0.9407078 0.76308483]",
 
736
  "[0.68062544 0.98093534 0.14778823 0.53244978]",
737
  "[1.68062544 1.98093534 1.14778829 1.53244972]"
738
  ],
 
 
 
 
739
  [
740
  "[0.79121011 0.54161114 0.69369799 0.1520769 ]",
741
  "[1.79121017 1.54161119 1.69369793 1.15207696]"
 
749
  "[1.23942459 1.90487361 1.69337189 1.65089428]"
750
  ],
751
  [
752
+ "[0.94516498 0.08422136 0.5608117 0.07652664]",
753
+ "[1.94516492 1.08422136 1.56081176 1.07652664]"
754
  ],
755
  [
756
  "[0.30754459 0.77694583 0.09278506 0.38326019]",
 
776
  "[0.78956431 0.87284744 0.06880784 0.03455889]",
777
  "[1.78956437 1.87284744 1.06880784 1.03455889]"
778
  ],
779
+ [
780
+ "[0.94221359 0.57740951 0.98649532 0.40934443]",
781
+ "[1.94221354 1.57740951 1.98649526 1.40934443]"
782
+ ],
783
  [
784
  "[0.00497234 0.39319336 0.57054168 0.75150961]",
785
  "[1.00497234 1.39319336 1.57054162 1.75150967]"
 
845
  "[1.95928192 1.84273899 1.7151463 1.38619852]"
846
  ],
847
  [
848
+ "[0.54914117 0.03810108 0.87531954 0.73044223]",
849
+ "[1.54914117 1.03810108 1.87531948 1.73044229]"
 
 
 
 
 
 
 
 
850
  ],
851
  [
852
  "[0.67418337 0.79634351 0.23229051 0.71345252]",
 
861
  "[1.81788456 1.58174157 1.29376316 1.79712534]"
862
  ],
863
  [
864
+ "[0.94559073 0.65736622 0.25761551 0.48553199]",
865
+ "[1.94559073 1.65736628 1.25761557 1.48553205]"
866
  ],
867
  [
868
+ "[0.60075855 0.12234765 0.00614399 0.30560958]",
869
+ "[1.60075855 1.12234759 1.00614405 1.30560958]"
870
  ],
871
  [
872
  "[0.02162331 0.81861657 0.92468154 0.07808572]",
 
896
  "[0.60609657 0.96257663 0.19292736 0.95702219]",
897
  "[1.60609651 1.96257663 1.19292736 1.95702219]"
898
  ],
899
+ [
900
+ "[0.80654246 0.08253473 0.74478531 0.71257162]",
901
+ "[1.8065424 1.08253479 1.74478531 1.71257162]"
902
+ ],
903
  [
904
  "[0.70167565 0.26930219 0.5660674 0.61194974]",
905
  "[1.70167565 1.26930213 1.56606746 1.61194968]"
 
908
  "[0.76933283 0.86241865 0.44114518 0.65644735]",
909
  "[1.76933289 1.86241865 1.44114518 1.65644741]"
910
  ],
911
+ [
912
+ "[0.59492421 0.90274489 0.38069052 0.46101224]",
913
+ "[1.59492421 1.90274489 1.38069057 1.46101224]"
914
+ ],
915
  [
916
  "[0.15064228 0.03198934 0.25754827 0.51484001]",
917
  "[1.15064228 1.03198934 1.25754833 1.51484001]"
 
949
  "[1.40234613 1.54987347 1.49542785 1.5415318 ]"
950
  ],
951
  [
952
+ "[0.12858278 0.09930819 0.83222693 0.72485673]",
953
+ "[1.12858272 1.09930825 1.83222699 1.72485673]"
954
  ],
955
  [
956
  "[0.72470158 0.4940322 0.41027349 0.89364016]",
957
  "[1.72470164 1.49403214 1.41027355 1.89364016]"
958
  ],
959
+ [
960
+ "[0.47856545 0.46267092 0.6376707 0.84747767]",
961
+ "[1.47856545 1.46267092 1.63767076 1.84747767]"
962
+ ],
963
  [
964
  "[0.49584109 0.80599248 0.07096875 0.75872749]",
965
  "[1.49584103 1.80599248 1.07096875 1.75872755]"
 
980
  "[0.68094063 0.45189077 0.22661722 0.37354094]",
981
  "[1.68094063 1.45189071 1.22661722 1.37354088]"
982
  ],
 
 
 
 
983
  [
984
  "[0.47870928 0.17129105 0.27300501 0.20634609]",
985
  "[1.47870922 1.17129111 1.27300501 1.20634604]"
 
1000
  }
1001
  },
1002
  "other": {
1003
+ "model": "ModelConfig(model=Sequential(\n (0) - Identity(): Input__tensor_1_x -> START_Repeat_1_output\n (1) - Linear(in_features=4, out_features=4, bias=True): START_Repeat_1_output -> Linear_1_output\n (2) - <function leaky_relu at 0x762d1f82c680>: Linear_1_output -> Activation_1_output\n (3) - Identity(): Activation_1_output -> START_Repeat_1_output\n (4) - Linear(in_features=4, out_features=4, bias=True): START_Repeat_1_output -> Linear_1_output\n (5) - <function leaky_relu at 0x762d1f82c680>: Linear_1_output -> Activation_1_output\n (6) - Identity(): Activation_1_output -> END_Repeat_1_output\n (7) - Identity(): END_Repeat_1_output -> END_Repeat_1_output\n), model_inputs=['Input__tensor_1_x'], model_outputs=['END_Repeat_1_output'], loss_inputs=['END_Repeat_1_output', 'Input__tensor_3_x'], loss=Sequential(\n (0) - <function mse_loss at 0x762d1f82e160>: END_Repeat_1_output, Input__tensor_3_x -> MSE_loss_2_output\n (1) - Identity(): MSE_loss_2_output -> loss\n), optimizer_parameters={'lr': 0.1, 'type': <OptionsFor_type.SGD: 4>}, optimizer=SGD (\nParameter Group 0\n dampening: 0\n differentiable: False\n foreach: None\n fused: None\n lr: 0.1\n maximize: False\n momentum: 0\n nesterov: False\n weight_decay: 0\n), source_workspace='Model definition', trained=True)"
1004
  },
1005
  "relations": []
1006
  },
 
1016
  },
1017
  "df_test": {
1018
  "columns": [
1019
+ "pred",
1020
  "x",
1021
  "y"
1022
  ]
 
1035
  "Input__tensor_1_x"
1036
  ],
1037
  "loss_inputs": [
1038
+ "END_Repeat_1_output",
1039
+ "Input__tensor_3_x"
1040
  ],
1041
  "outputs": [
1042
  "END_Repeat_1_output"
 
1210
  "Input__tensor_1_x"
1211
  ],
1212
  "loss_inputs": [
1213
+ "END_Repeat_1_output",
1214
+ "Input__tensor_3_x"
1215
  ],
1216
  "outputs": [
1217
  "END_Repeat_1_output"
 
1270
  "type": "basic"
1271
  },
1272
  "params": {
1273
+ "epochs": "1003",
1274
  "input_mapping": "{\"map\":{\"Input__tensor_1_x\":{\"df\":\"df_train\",\"column\":\"x\"},\"Input__tensor_3_x\":{\"df\":\"df_train\",\"column\":\"y\"}}}",
1275
  "model_name": "model"
1276
  },
 
1322
  "Input__tensor_1_x"
1323
  ],
1324
  "loss_inputs": [
1325
+ "END_Repeat_1_output",
1326
+ "Input__tensor_3_x"
1327
  ],
1328
  "outputs": [
1329
  "END_Repeat_1_output"
 
1384
  "params": {
1385
  "input_mapping": "{\"map\":{\"Input__tensor_1_x\":{\"df\":\"df_test\",\"column\":\"x\"}}}",
1386
  "model_name": "model",
1387
+ "output_mapping": "{\"map\":{\"END_Repeat_1_output\":{\"df\":\"df_test\",\"column\":\"pred\"}}}"
1388
  },
1389
  "status": "done",
1390
  "title": "Model inference"
1391
  },
1392
  "dragHandle": ".bg-primary",
1393
+ "height": 650.0,
1394
  "id": "Model inference 1",
1395
  "position": {
1396
  "x": 2181.718373860645,
lynxkite-app/web/src/workspace/nodes/NodeParameter.tsx CHANGED
@@ -91,6 +91,7 @@ function ModelMapping({ value, onChange, data, variant }: any) {
91
  const dfs: { [df: string]: string[] } = {};
92
  const inputs = data?.input_metadata?.value ?? data?.input_metadata ?? [];
93
  for (const input of inputs) {
 
94
  const dataframes = input.dataframes as {
95
  [df: string]: { columns: string[] };
96
  };
 
91
  const dfs: { [df: string]: string[] } = {};
92
  const inputs = data?.input_metadata?.value ?? data?.input_metadata ?? [];
93
  for (const input of inputs) {
94
+ if (!input.dataframes) continue;
95
  const dataframes = input.dataframes as {
96
  [df: string]: { columns: string[] };
97
  };
lynxkite-core/src/lynxkite/core/ops.py CHANGED
@@ -1,6 +1,7 @@
1
  """API for implementing LynxKite operations."""
2
 
3
  from __future__ import annotations
 
4
  import enum
5
  import functools
6
  import inspect
@@ -297,3 +298,13 @@ def op_registration(env: str):
297
  def passive_op_registration(env: str):
298
  """Returns a function that can be used to register operations without associated code."""
299
  return functools.partial(register_passive_op, env)
 
 
 
 
 
 
 
 
 
 
 
1
  """API for implementing LynxKite operations."""
2
 
3
  from __future__ import annotations
4
+ import asyncio
5
  import enum
6
  import functools
7
  import inspect
 
298
  def passive_op_registration(env: str):
299
  """Returns a function that can be used to register operations without associated code."""
300
  return functools.partial(register_passive_op, env)
301
+
302
+
303
+ def slow(func):
304
+ """Decorator for slow, blocking operations. Turns them into separate threads."""
305
+
306
+ @functools.wraps(func)
307
+ async def wrapper(*args, **kwargs):
308
+ return await asyncio.to_thread(func, *args, **kwargs)
309
+
310
+ return wrapper
lynxkite-graph-analytics/src/lynxkite_graph_analytics/core.py CHANGED
@@ -1,5 +1,6 @@
1
  """Graph analytics executor and data types."""
2
 
 
3
  import os
4
  from lynxkite.core import ops, workspace
5
  import dataclasses
@@ -177,10 +178,16 @@ async def execute(ws: workspace.Workspace):
177
  # All inputs for this node are ready, we can compute the output.
178
  todo.remove(id)
179
  progress = True
180
- _execute_node(node, ws, catalog, outputs)
181
 
182
 
183
- def _execute_node(node, ws, catalog, outputs):
 
 
 
 
 
 
184
  params = {**node.data.params}
185
  op = catalog.get(node.data.title)
186
  if not op:
@@ -214,6 +221,7 @@ def _execute_node(node, ws, catalog, outputs):
214
  # Execute op.
215
  try:
216
  result = op(*inputs, **params)
 
217
  except Exception as e:
218
  if os.environ.get("LYNXKITE_LOG_OP_ERRORS"):
219
  traceback.print_exc()
 
1
  """Graph analytics executor and data types."""
2
 
3
+ import inspect
4
  import os
5
  from lynxkite.core import ops, workspace
6
  import dataclasses
 
178
  # All inputs for this node are ready, we can compute the output.
179
  todo.remove(id)
180
  progress = True
181
+ await _execute_node(node, ws, catalog, outputs)
182
 
183
 
184
+ async def await_if_needed(obj):
185
+ if inspect.isawaitable(obj):
186
+ obj = await obj
187
+ return obj
188
+
189
+
190
+ async def _execute_node(node, ws, catalog, outputs):
191
  params = {**node.data.params}
192
  op = catalog.get(node.data.title)
193
  if not op:
 
221
  # Execute op.
222
  try:
223
  result = op(*inputs, **params)
224
+ result.output = await await_if_needed(result.output)
225
  except Exception as e:
226
  if os.environ.get("LYNXKITE_LOG_OP_ERRORS"):
227
  traceback.print_exc()
lynxkite-graph-analytics/src/lynxkite_graph_analytics/lynxkite_ops.py CHANGED
@@ -369,6 +369,7 @@ class ModelOutputMapping(pytorch_model_ops.ModelMapping):
369
 
370
 
371
  @op("Train model")
 
372
  def train_model(
373
  bundle: core.Bundle,
374
  *,
@@ -380,9 +381,11 @@ def train_model(
380
  m = bundle.other[model_name].copy()
381
  inputs = pytorch_model_ops.to_tensors(bundle, input_mapping)
382
  t = tqdm(range(epochs), desc="Training model")
 
383
  for _ in t:
384
  loss = m.train(inputs)
385
  t.set_postfix({"loss": loss})
 
386
  m.trained = True
387
  bundle = bundle.copy()
388
  bundle.other[model_name] = m
@@ -390,6 +393,7 @@ def train_model(
390
 
391
 
392
  @op("Model inference")
 
393
  def model_inference(
394
  bundle: core.Bundle,
395
  *,
 
369
 
370
 
371
  @op("Train model")
372
+ @ops.slow
373
  def train_model(
374
  bundle: core.Bundle,
375
  *,
 
381
  m = bundle.other[model_name].copy()
382
  inputs = pytorch_model_ops.to_tensors(bundle, input_mapping)
383
  t = tqdm(range(epochs), desc="Training model")
384
+ losses = []
385
  for _ in t:
386
  loss = m.train(inputs)
387
  t.set_postfix({"loss": loss})
388
+ losses.append(loss)
389
  m.trained = True
390
  bundle = bundle.copy()
391
  bundle.other[model_name] = m
 
393
 
394
 
395
  @op("Model inference")
396
+ @ops.slow
397
  def model_inference(
398
  bundle: core.Bundle,
399
  *,