|
123 | 123 | "name": "stdout",
|
124 | 124 | "output_type": "stream",
|
125 | 125 | "text": [
|
126 |
| - "OrderedDict([('0.weight', tensor([[1.9690]], device='cuda:0')), ('0.bias', tensor([1.0235], device='cuda:0'))])\n" |
| 126 | + "OrderedDict([('0.weight', tensor([[1.9690]])), ('0.bias', tensor([1.0235]))])\n" |
127 | 127 | ]
|
128 | 128 | }
|
129 | 129 | ],
|
|
327 | 327 | "name": "stdout",
|
328 | 328 | "output_type": "stream",
|
329 | 329 | "text": [
|
330 |
| - "Writing model_configuration/v1.py\n" |
| 330 | + "Overwriting model_configuration/v1.py\n" |
331 | 331 | ]
|
332 | 332 | }
|
333 | 333 | ],
|
|
370 | 370 | {
|
371 | 371 | "data": {
|
372 | 372 | "text/plain": [
|
373 |
| - "<function __main__.make_train_step.<locals>.perform_train_step(x, y)>" |
| 373 | + "<function __main__.make_train_step_fn.<locals>.perform_train_step_fn(x, y)>" |
374 | 374 | ]
|
375 | 375 | },
|
376 | 376 | "execution_count": 18,
|
|
398 | 398 | "name": "stdout",
|
399 | 399 | "output_type": "stream",
|
400 | 400 | "text": [
|
401 |
| - "Writing model_training/v1.py\n" |
| 401 | + "Overwriting model_training/v1.py\n" |
402 | 402 | ]
|
403 | 403 | }
|
404 | 404 | ],
|
|
435 | 435 | "name": "stdout",
|
436 | 436 | "output_type": "stream",
|
437 | 437 | "text": [
|
438 |
| - "OrderedDict([('0.weight', tensor([[1.9690]], device='cuda:0')), ('0.bias', tensor([1.0235], device='cuda:0'))])\n" |
| 438 | + "OrderedDict([('0.weight', tensor([[1.9690]])), ('0.bias', tensor([1.0235]))])\n" |
439 | 439 | ]
|
440 | 440 | }
|
441 | 441 | ],
|
|
556 | 556 | {
|
557 | 557 | "data": {
|
558 | 558 | "text/plain": [
|
559 |
| - "[tensor([[0.1196],\n", |
560 |
| - " [0.1395],\n", |
561 |
| - " [0.2809],\n", |
562 |
| - " [0.1834],\n", |
563 |
| - " [0.3585],\n", |
| 559 | + "[tensor([[0.9507],\n", |
564 | 560 | " [0.5427],\n",
|
565 |
| - " [0.0885],\n", |
566 |
| - " [0.9489],\n", |
567 |
| - " [0.9699],\n", |
568 |
| - " [0.7751],\n", |
569 |
| - " [0.9696],\n", |
570 |
| - " [0.7320],\n", |
571 |
| - " [0.0055],\n", |
572 |
| - " [0.7069],\n", |
573 |
| - " [0.8155],\n", |
574 |
| - " [0.5979]]), tensor([[1.3214],\n", |
575 |
| - " [1.3051],\n", |
576 |
| - " [1.5846],\n", |
577 |
| - " [1.4637],\n", |
578 |
| - " [1.7462],\n", |
| 561 | + " [0.1409],\n", |
| 562 | + " [0.3745],\n", |
| 563 | + " [0.1987],\n", |
| 564 | + " [0.8948],\n", |
| 565 | + " [0.7722],\n", |
| 566 | + " [0.7852],\n", |
| 567 | + " [0.5248],\n", |
| 568 | + " [0.2809],\n", |
| 569 | + " [0.1159],\n", |
| 570 | + " [0.0740],\n", |
| 571 | + " [0.1849],\n", |
| 572 | + " [0.4561],\n", |
| 573 | + " [0.7608],\n", |
| 574 | + " [0.1560]]), tensor([[2.8715],\n", |
579 | 575 | " [2.2161],\n",
|
580 |
| - " [1.0708],\n", |
581 |
| - " [2.8903],\n", |
582 |
| - " [2.9727],\n", |
583 |
| - " [2.4936],\n", |
584 |
| - " [2.8401],\n", |
585 |
| - " [2.4732],\n", |
586 |
| - " [1.0632],\n", |
587 |
| - " [2.4388],\n", |
588 |
| - " [2.6606],\n", |
589 |
| - " [2.0407]])]" |
| 576 | + " [1.1211],\n", |
| 577 | + " [1.7578],\n", |
| 578 | + " [1.2654],\n", |
| 579 | + " [2.7393],\n", |
| 580 | + " [2.4208],\n", |
| 581 | + " [2.5283],\n", |
| 582 | + " [2.0167],\n", |
| 583 | + " [1.5846],\n", |
| 584 | + " [1.1603],\n", |
| 585 | + " [1.1713],\n", |
| 586 | + " [1.5888],\n", |
| 587 | + " [1.7706],\n", |
| 588 | + " [2.4970],\n", |
| 589 | + " [1.2901]])]" |
590 | 590 | ]
|
591 | 591 | },
|
592 | 592 | "execution_count": 25,
|
|
614 | 614 | "name": "stdout",
|
615 | 615 | "output_type": "stream",
|
616 | 616 | "text": [
|
617 |
| - "Writing data_preparation/v1.py\n" |
| 617 | + "Overwriting data_preparation/v1.py\n" |
618 | 618 | ]
|
619 | 619 | }
|
620 | 620 | ],
|
|
666 | 666 | "name": "stdout",
|
667 | 667 | "output_type": "stream",
|
668 | 668 | "text": [
|
669 |
| - "Writing model_training/v2.py\n" |
| 669 | + "Overwriting model_training/v2.py\n" |
670 | 670 | ]
|
671 | 671 | }
|
672 | 672 | ],
|
|
718 | 718 | "name": "stdout",
|
719 | 719 | "output_type": "stream",
|
720 | 720 | "text": [
|
721 |
| - "OrderedDict([('0.weight', tensor([[1.9684]], device='cuda:0')), ('0.bias', tensor([1.0235], device='cuda:0'))])\n" |
| 721 | + "OrderedDict([('0.weight', tensor([[1.9694]])), ('0.bias', tensor([1.0234]))])\n" |
722 | 722 | ]
|
723 | 723 | }
|
724 | 724 | ],
|
|
1013 | 1013 | "\n",
|
1014 | 1014 | "for epoch in range(n_epochs):\n",
|
1015 | 1015 | " # inner loop\n",
|
1016 |
| - " loss = mini_batch(device, train_loader, train_step)\n", |
| 1016 | + " loss = mini_batch(device, train_loader, train_step_fn)\n", |
1017 | 1017 | " losses.append(loss)\n",
|
1018 | 1018 | " \n",
|
1019 | 1019 | " # VALIDATION\n",
|
|
1267 | 1267 | "loss_fn = nn.MSELoss(reduction='mean')\n",
|
1268 | 1268 | "\n",
|
1269 | 1269 | "# Creates the train_step function for our model, loss function and optimizer\n",
|
1270 |
| - "train_step = make_train_step(model, loss_fn, optimizer)\n", |
| 1270 | + "train_step_fn = make_train_step_fn(model, loss_fn, optimizer)\n", |
1271 | 1271 | "\n",
|
1272 | 1272 | "# Creates the val_step function for our model and loss function\n",
|
1273 | 1273 | "val_step_fn = make_val_step_fn(model, loss_fn)\n",
|
|
1320 | 1320 | "\n",
|
1321 | 1321 | "for epoch in range(n_epochs):\n",
|
1322 | 1322 | " # inner loop\n",
|
1323 |
| - " loss = mini_batch(device, train_loader, train_step)\n", |
| 1323 | + " loss = mini_batch(device, train_loader, train_step_fn)\n", |
1324 | 1324 | " losses.append(loss)\n",
|
1325 | 1325 | " \n",
|
1326 | 1326 | " # VALIDATION\n",
|
|
1812 | 1812 | "name": "python",
|
1813 | 1813 | "nbconvert_exporter": "python",
|
1814 | 1814 | "pygments_lexer": "ipython3",
|
1815 |
| - "version": "3.8.5" |
| 1815 | + "version": "3.7.5" |
1816 | 1816 | }
|
1817 | 1817 | },
|
1818 | 1818 | "nbformat": 4,
|
|
0 commit comments