File size: 58,712 Bytes
7173650 | 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 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Neural Network Visualizer | Model Fine-Tuning</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.neuron {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
position: relative;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
transition: all 0.3s ease;
}
.layer {
display: flex;
flex-direction: column;
gap: 20px;
align-items: center;
position: relative;
}
.connection {
position: absolute;
background: rgba(156, 163, 175, 0.3);
transform-origin: 0 0;
z-index: -1;
transition: all 0.3s ease;
}
.connection.active {
background: rgba(16, 185, 129, 0.6);
height: 2px;
}
.code-editor {
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 1.5;
tab-size: 4;
}
.sidebar-item:hover {
background-color: rgba(55, 65, 81, 0.5);
}
.jupyter-cell {
border-left: 4px solid #3b82f6;
}
.jupyter-output {
background-color: rgba(31, 41, 55, 0.7);
}
.draggable {
cursor: move;
}
.resizable {
resize: horizontal;
overflow: auto;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.animate-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.model-card {
transition: all 0.2s ease;
}
.model-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}
.model-card.selected {
border-color: #3b82f6;
background-color: rgba(59, 130, 246, 0.1);
}
.language-tag {
transition: all 0.2s ease;
}
.language-tag:hover {
transform: scale(1.05);
}
.language-tag.selected {
background-color: #3b82f6;
color: white;
}
.param-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 18px;
height: 18px;
border-radius: 50%;
background: #3b82f6;
cursor: pointer;
}
.param-slider::-moz-range-thumb {
width: 18px;
height: 18px;
border-radius: 50%;
background: #3b82f6;
cursor: pointer;
}
.tab-button {
transition: all 0.2s ease;
}
.tab-button.active {
border-bottom: 2px solid #3b82f6;
color: #3b82f6;
}
.activation-node {
width: 12px;
height: 12px;
border-radius: 50%;
position: absolute;
bottom: -6px;
left: 50%;
transform: translateX(-50%);
}
</style>
</head>
<body class="bg-gray-900 text-gray-200 h-screen flex flex-col overflow-hidden">
<!-- Top Menu Bar -->
<div class="bg-gray-800 px-4 py-2 flex items-center justify-between border-b border-gray-700">
<div class="flex items-center space-x-4">
<span class="font-bold text-blue-400 flex items-center">
<i class="fas fa-brain mr-2"></i>
<span>Neural Visualizer Pro</span>
</span>
<div class="flex space-x-2 text-sm">
<button class="px-2 py-1 hover:bg-gray-700 rounded">File</button>
<button class="px-2 py-1 hover:bg-gray-700 rounded">Edit</button>
<button class="px-2 py-1 hover:bg-gray-700 rounded">View</button>
<button class="px-2 py-1 hover:bg-gray-700 rounded">Run</button>
<button class="px-2 py-1 hover:bg-gray-700 rounded">Help</button>
</div>
</div>
<div class="flex items-center space-x-3">
<span class="text-xs text-gray-400">Interactive Mode</span>
<div class="w-3 h-3 rounded-full bg-green-500 animate-pulse"></div>
<button class="text-xs px-3 py-1 bg-blue-600 rounded hover:bg-blue-700">
<i class="fas fa-cloud-upload-alt mr-1"></i> Save Model
</button>
</div>
</div>
<div class="flex flex-1 overflow-hidden">
<!-- Sidebar -->
<div class="w-16 bg-gray-800 flex flex-col items-center py-4 border-r border-gray-700">
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 bg-gray-700 text-blue-400">
<i class="fas fa-project-diagram text-xl"></i>
</button>
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 hover:text-blue-400">
<i class="fas fa-layer-group text-xl"></i>
</button>
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 hover:text-blue-400">
<i class="fas fa-sliders-h text-xl"></i>
</button>
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 hover:text-blue-400">
<i class="fas fa-chart-line text-xl"></i>
</button>
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 hover:text-blue-400">
<i class="fas fa-language text-xl"></i>
</button>
<div class="mt-auto">
<button class="sidebar-item w-12 h-12 rounded-lg flex items-center justify-center mb-4 hover:text-blue-400">
<i class="fas fa-cog text-xl"></i>
</button>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex overflow-hidden">
<!-- Editor Panel -->
<div class="w-1/2 flex flex-col border-r border-gray-700">
<div class="bg-gray-800 px-4 py-2 flex items-center justify-between">
<div class="flex items-center space-x-2">
<i class="fas fa-file-code text-blue-400"></i>
<span class="text-sm">model_config.py</span>
</div>
<div class="flex space-x-2">
<button class="text-xs px-2 py-1 bg-blue-600 rounded hover:bg-blue-700">
<i class="fas fa-play mr-1"></i> Run
</button>
<button class="text-xs px-2 py-1 bg-gray-700 rounded hover:bg-gray-600">
<i class="fas fa-terminal mr-1"></i> Console
</button>
</div>
</div>
<div class="flex-1 overflow-auto bg-gray-900 p-4 code-editor">
<!-- Model Selection Tabs -->
<div class="flex border-b border-gray-700 mb-4">
<button class="tab-button px-4 py-2 text-sm font-medium active" data-tab="config">
<i class="fas fa-cog mr-2"></i>Configuration
</button>
<button class="tab-button px-4 py-2 text-sm font-medium" data-tab="training">
<i class="fas fa-running mr-2"></i>Training
</button>
<button class="tab-button px-4 py-2 text-sm font-medium" data-tab="fine-tuning">
<i class="fas fa-magic mr-2"></i>Fine-Tuning
</button>
</div>
<!-- Config Tab Content -->
<div id="config-tab" class="tab-content">
<div class="jupyter-cell mb-4 pl-2">
<div class="text-green-400"># Model Configuration</div>
<div class="text-gray-500"># Select a base model and customize parameters</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-purple-400">from</div> <div class="text-gray-200">transformers</div> <div class="text-purple-400">import</div> <div class="text-gray-200">AutoModelForSequenceClassification</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Available Models (click to select)</div>
<div class="grid grid-cols-3 gap-4 mb-4">
<div class="model-card p-4 border border-gray-700 rounded-lg cursor-pointer bg-gray-800 selected" data-model="llama-2">
<div class="flex items-center mb-2">
<i class="fas fa-robot text-blue-400 mr-2"></i>
<span class="font-medium">LLaMA 2</span>
</div>
<div class="text-xs text-gray-400">7B parameters</div>
<div class="text-xs text-gray-400">Context: 4096</div>
</div>
<div class="model-card p-4 border border-gray-700 rounded-lg cursor-pointer bg-gray-800" data-model="gpt-3">
<div class="flex items-center mb-2">
<i class="fas fa-brain text-purple-400 mr-2"></i>
<span class="font-medium">GPT-3.5</span>
</div>
<div class="text-xs text-gray-400">175B parameters</div>
<div class="text-xs text-gray-400">Context: 4096</div>
</div>
<div class="model-card p-4 border border-gray-700 rounded-lg cursor-pointer bg-gray-800" data-model="bert">
<div class="flex items-center mb-2">
<i class="fas fa-shield-alt text-green-400 mr-2"></i>
<span class="font-medium">BERT</span>
</div>
<div class="text-xs text-gray-400">340M parameters</div>
<div class="text-xs text-gray-400">Context: 512</div>
</div>
</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Model Parameters</div>
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-400 mb-1">Learning Rate</label>
<div class="flex items-center space-x-4">
<input type="range" min="0.0001" max="0.01" step="0.0001" value="0.001" class="param-slider w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
<span class="text-xs bg-gray-800 px-2 py-1 rounded">0.001</span>
</div>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">Batch Size</label>
<div class="flex items-center space-x-4">
<input type="range" min="8" max="128" step="8" value="32" class="param-slider w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
<span class="text-xs bg-gray-800 px-2 py-1 rounded">32</span>
</div>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">Epochs</label>
<div class="flex items-center space-x-4">
<input type="range" min="1" max="50" step="1" value="10" class="param-slider w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
<span class="text-xs bg-gray-800 px-2 py-1 rounded">10</span>
</div>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">Dropout Rate</label>
<div class="flex items-center space-x-4">
<input type="range" min="0" max="0.5" step="0.05" value="0.1" class="param-slider w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
<span class="text-xs bg-gray-800 px-2 py-1 rounded">0.1</span>
</div>
</div>
</div>
</div>
</div>
<!-- Training Tab Content -->
<div id="training-tab" class="tab-content hidden">
<div class="jupyter-cell mb-4 pl-2">
<div class="text-green-400"># Training Configuration</div>
<div class="text-gray-500"># Set up your training parameters and data</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Dataset Selection</div>
<select class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm mb-4">
<option>Custom Dataset</option>
<option>GLUE Benchmark</option>
<option>SQuAD 2.0</option>
<option>IMDB Reviews</option>
<option>Swahili News Dataset</option>
</select>
<div class="text-sm text-gray-400 mb-2">Or upload your own dataset:</div>
<div class="border-2 border-dashed border-gray-700 rounded-lg p-4 text-center cursor-pointer hover:bg-gray-800 mb-4">
<i class="fas fa-cloud-upload-alt text-2xl text-blue-400 mb-2"></i>
<div class="text-sm">Click to upload or drag and drop</div>
<div class="text-xs text-gray-500 mt-1">CSV, JSON, or TXT files</div>
</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Training Options</div>
<div class="space-y-3">
<label class="flex items-center space-x-2 cursor-pointer">
<input type="checkbox" class="form-checkbox text-blue-500 rounded" checked>
<span class="text-sm">Use mixed precision training</span>
</label>
<label class="flex items-center space-x-2 cursor-pointer">
<input type="checkbox" class="form-checkbox text-blue-500 rounded">
<span class="text-sm">Enable gradient checkpointing</span>
</label>
<label class="flex items-center space-x-2 cursor-pointer">
<input type="checkbox" class="form-checkbox text-blue-500 rounded" checked>
<span class="text-sm">Use learning rate scheduling</span>
</label>
<label class="flex items-center space-x-2 cursor-pointer">
<input type="checkbox" class="form-checkbox text-blue-500 rounded">
<span class="text-sm">Enable early stopping</span>
</label>
</div>
</div>
</div>
<!-- Fine-Tuning Tab Content -->
<div id="fine-tuning-tab" class="tab-content hidden">
<div class="jupyter-cell mb-4 pl-2">
<div class="text-green-400"># Fine-Tuning Options</div>
<div class="text-gray-500"># Customize for specific languages or domains</div>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Language Specialization</div>
<div class="flex flex-wrap gap-2 mb-4">
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer selected" data-lang="en">
<i class="fas fa-check-circle mr-1"></i> English
</div>
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer" data-lang="sw">
<i class="fas fa-globe-africa mr-1"></i> Swahili
</div>
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer" data-lang="fr">
<i class="fas fa-baguette mr-1"></i> French
</div>
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer" data-lang="es">
<i class="fas fa-sun mr-1"></i> Spanish
</div>
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer" data-lang="de">
<i class="fas fa-landmark mr-1"></i> German
</div>
<div class="language-tag px-3 py-1 bg-gray-800 rounded-full text-xs cursor-pointer" data-lang="zh">
<i class="fas fa-yin-yang mr-1"></i> Chinese
</div>
</div>
<div class="text-sm text-gray-400 mb-2">Custom tokenizer for selected language:</div>
<textarea class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm h-20 mb-4" placeholder="Add special tokens or vocabulary for your language..."></textarea>
</div>
<div class="jupyter-cell mb-4 pl-2">
<div class="text-yellow-400 mb-2"># Domain Adaptation</div>
<select class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm mb-4">
<option>General Language</option>
<option>Medical</option>
<option>Legal</option>
<option>Financial</option>
<option>Technical</option>
<option>News</option>
</select>
<div class="text-sm text-gray-400 mb-2">Domain-specific vocabulary:</div>
<textarea class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm h-20" placeholder="Add domain-specific terms..."></textarea>
</div>
</div>
</div>
<div class="bg-gray-800 px-4 py-2 border-t border-gray-700">
<div class="flex items-center space-x-2 text-xs">
<span>Python 3.10.6</span>
<span class="text-gray-500">•</span>
<span>PyTorch 2.0.1</span>
<span class="text-gray-500">•</span>
<span>Transformers 4.30.2</span>
</div>
</div>
</div>
<!-- Visualization Panel -->
<div class="w-1/2 flex flex-col">
<div class="bg-gray-800 px-4 py-2 flex items-center justify-between">
<div class="flex items-center space-x-2">
<i class="fas fa-project-diagram text-blue-400"></i>
<span class="text-sm">Model Visualization & Training</span>
</div>
<div class="flex space-x-2">
<button class="text-xs px-2 py-1 bg-gray-700 rounded hover:bg-gray-600">
<i class="fas fa-sync-alt mr-1"></i> Refresh
</button>
<button class="text-xs px-2 py-1 bg-gray-700 rounded hover:bg-gray-600">
<i class="fas fa-expand mr-1"></i> Fullscreen
</button>
<button class="text-xs px-2 py-1 bg-blue-600 rounded hover:bg-blue-700">
<i class="fas fa-rocket mr-1"></i> Deploy
</button>
</div>
</div>
<div class="flex-1 overflow-auto bg-gray-900 p-8 flex flex-col">
<!-- Model Architecture Visualization -->
<div class="mb-8">
<div class="text-lg font-medium mb-4 flex items-center">
<i class="fas fa-network-wired text-blue-400 mr-2"></i>
<span>Model Architecture</span>
</div>
<div class="bg-gray-800 rounded-lg p-6">
<div class="flex items-center justify-center space-x-8" id="network-container">
<!-- Network visualization will be rendered here -->
</div>
</div>
</div>
<!-- Training Controls -->
<div class="mb-8">
<div class="text-lg font-medium mb-4 flex items-center">
<i class="fas fa-running text-green-400 mr-2"></i>
<span>Training Controls</span>
</div>
<div class="bg-gray-800 rounded-lg p-6">
<div class="grid grid-cols-3 gap-6 mb-6">
<div>
<label class="block text-sm text-gray-400 mb-2">Current Epoch</label>
<div class="text-2xl font-bold text-center">0</div>
</div>
<div>
<label class="block text-sm text-gray-400 mb-2">Training Loss</label>
<div class="text-2xl font-bold text-center">-</div>
</div>
<div>
<label class="block text-sm text-gray-400 mb-2">Validation Loss</label>
<div class="text-2xl font-bold text-center">-</div>
</div>
</div>
<div class="flex space-x-4">
<button class="flex-1 py-2 bg-green-600 rounded hover:bg-green-700 flex items-center justify-center">
<i class="fas fa-play mr-2"></i> Start Training
</button>
<button class="flex-1 py-2 bg-yellow-600 rounded hover:bg-yellow-700 flex items-center justify-center" disabled>
<i class="fas fa-pause mr-2"></i> Pause
</button>
<button class="flex-1 py-2 bg-red-600 rounded hover:bg-red-700 flex items-center justify-center" disabled>
<i class="fas fa-stop mr-2"></i> Stop
</button>
</div>
</div>
</div>
<!-- Training Progress Charts -->
<div class="mb-8">
<div class="text-lg font-medium mb-4 flex items-center">
<i class="fas fa-chart-line text-purple-400 mr-2"></i>
<span>Training Metrics</span>
</div>
<div class="grid grid-cols-2 gap-6">
<div class="bg-gray-800 rounded-lg p-4">
<canvas id="training-chart" height="200"></canvas>
</div>
<div class="bg-gray-800 rounded-lg p-4">
<canvas id="metrics-chart" height="200"></canvas>
</div>
</div>
</div>
<!-- Fine-Tuning Progress -->
<div>
<div class="text-lg font-medium mb-4 flex items-center">
<i class="fas fa-magic text-pink-400 mr-2"></i>
<span>Fine-Tuning Progress</span>
</div>
<div class="bg-gray-800 rounded-lg p-6">
<div class="mb-4">
<div class="flex justify-between text-sm mb-1">
<span>Language Adaptation (Swahili)</span>
<span>0%</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-blue-500 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
<div class="mb-4">
<div class="flex justify-between text-sm mb-1">
<span>Domain Specialization</span>
<span>0%</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
<div class="text-sm text-gray-400">
<i class="fas fa-info-circle mr-2"></i>
Fine-tuning will begin after initial training completes
</div>
</div>
</div>
</div>
<div class="bg-gray-800 px-4 py-2 border-t border-gray-700 flex justify-between items-center">
<div class="flex items-center space-x-4">
<button class="text-xs px-3 py-1 bg-blue-600 rounded hover:bg-blue-700">
<i class="fas fa-play mr-1"></i> Train Model
</button>
<div class="flex items-center space-x-2 text-xs">
<span>GPU:</span>
<span class="px-2 py-1 bg-gray-700 rounded">NVIDIA A100</span>
</div>
<div class="flex items-center space-x-2 text-xs">
<span>Memory:</span>
<span class="px-2 py-1 bg-gray-700 rounded">32GB</span>
</div>
</div>
<div class="text-xs text-gray-400">
<i class="fas fa-circle text-green-500 mr-1"></i> Ready
</div>
</div>
</div>
</div>
</div>
<script>
// Initialize the neural network visualization
document.addEventListener('DOMContentLoaded', function() {
// Network configuration
const layers = [4, 8, 8, 4];
const colors = ['bg-blue-500', 'bg-purple-500', 'bg-pink-500', 'bg-green-500'];
const activations = ['sigmoid', 'relu', 'tanh', 'linear'];
// Draw the network
drawNetwork(layers, colors, activations);
// Initialize charts
initTrainingChart();
initMetricsChart();
// Make the editor panel resizable
const editorPanel = document.querySelector('.w-1/2');
editorPanel.classList.add('resizable');
// Add draggable functionality to neurons
makeNeuronsDraggable();
// Setup tab switching
setupTabs();
// Setup model selection
setupModelSelection();
// Setup language selection
setupLanguageSelection();
// Update slider values
updateSliderValues();
// Simulate training when train button is clicked
simulateTraining();
});
function drawNetwork(layers, colors, activations) {
const container = document.getElementById('network-container');
container.innerHTML = '';
// Calculate positions for all neurons
const maxNeurons = Math.max(...layers);
const layerSpacing = 200;
const neuronSpacing = 60;
// Create each layer
layers.forEach((neuronCount, layerIndex) => {
const layerDiv = document.createElement('div');
layerDiv.className = 'layer';
// Calculate vertical offset to center the layer
const verticalOffset = ((maxNeurons - neuronCount) * neuronSpacing) / 2;
// Create neurons in this layer
for (let i = 0; i < neuronCount; i++) {
const neuron = document.createElement('div');
neuron.className = `neuron ${colors[layerIndex]} draggable`;
neuron.textContent = `${layerIndex+1}.${i+1}`;
neuron.dataset.layer = layerIndex;
neuron.dataset.neuron = i;
neuron.style.top = `${verticalOffset + i * neuronSpacing}px`;
neuron.style.left = `${layerIndex * layerSpacing}px`;
// Add activation indicator
const activationNode = document.createElement('div');
activationNode.className = `activation-node bg-${getActivationColor(activations[layerIndex])}`;
activationNode.title = activations[layerIndex];
neuron.appendChild(activationNode);
layerDiv.appendChild(neuron);
}
// Add layer label
const layerLabel = document.createElement('div');
layerLabel.className = 'text-xs mt-2 text-gray-400';
if (layerIndex === 0) {
layerLabel.textContent = 'Input Layer';
} else if (layerIndex === layers.length - 1) {
layerLabel.textContent = 'Output Layer';
} else {
layerLabel.textContent = `Hidden Layer ${layerIndex}`;
}
layerDiv.appendChild(layerLabel);
container.appendChild(layerDiv);
});
// Draw connections between neurons
if (layers.length > 1) {
for (let l = 0; l < layers.length - 1; l++) {
const currentLayerCount = layers[l];
const nextLayerCount = layers[l + 1];
for (let i = 0; i < currentLayerCount; i++) {
for (let j = 0; j < nextLayerCount; j++) {
const startNeuron = document.querySelector(`[data-layer="${l}"][data-neuron="${i}"]`);
const endNeuron = document.querySelector(`[data-layer="${l+1}"][data-neuron="${j}"]`);
if (startNeuron && endNeuron) {
const startRect = startNeuron.getBoundingClientRect();
const endRect = endNeuron.getBoundingClientRect();
const containerRect = container.getBoundingClientRect();
const startX = startRect.left + startRect.width/2 - containerRect.left;
const startY = startRect.top + startRect.height/2 - containerRect.top;
const endX = endRect.left + endRect.width/2 - containerRect.left;
const endY = endRect.top + endRect.height/2 - containerRect.top;
const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
const angle = Math.atan2(endY - startY, endX - startX) * 180 / Math.PI;
const connection = document.createElement('div');
connection.className = 'connection';
connection.style.width = `${length}px`;
connection.style.height = '1px';
connection.style.left = `${startX}px`;
connection.style.top = `${startY}px`;
connection.style.transform = `rotate(${angle}deg)`;
// Randomly make some connections more visible to show weights
if (Math.random() < 0.3) {
connection.classList.add('active');
}
container.appendChild(connection);
}
}
}
}
}
}
function getActivationColor(activation) {
switch(activation) {
case 'relu': return 'red-500';
case 'sigmoid': return 'blue-500';
case 'tanh': return 'purple-500';
case 'linear': return 'green-500';
default: return 'gray-500';
}
}
function initTrainingChart() {
const ctx = document.getElementById('training-chart').getContext('2d');
const chart = new Chart(ctx, {
type: 'line',
data: {
labels: Array.from({length: 20}, (_, i) => i * 5),
datasets: [
{
label: 'Training Loss',
data: [2.5, 2.1, 1.8, 1.5, 1.2, 0.9, 0.7, 0.5, 0.4, 0.3, 0.25, 0.2, 0.18, 0.16, 0.15, 0.14, 0.13, 0.12, 0.11, 0.1],
borderColor: 'rgb(99, 102, 241)',
backgroundColor: 'rgba(99, 102, 241, 0.1)',
tension: 0.4,
fill: true
},
{
label: 'Validation Loss',
data: [2.6, 2.3, 2.0, 1.7, 1.4, 1.1, 0.9, 0.7, 0.6, 0.5, 0.45, 0.4, 0.38, 0.36, 0.35, 0.34, 0.33, 0.32, 0.31, 0.3],
borderColor: 'rgb(236, 72, 153)',
backgroundColor: 'rgba(236, 72, 153, 0.1)',
tension: 0.4,
fill: true
}
]
},
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Training Loss',
color: '#E5E7EB'
},
legend: {
labels: {
color: '#E5E7EB'
}
}
},
scales: {
x: {
title: {
display: true,
text: 'Epoch',
color: '#9CA3AF'
},
ticks: {
color: '#9CA3AF'
},
grid: {
color: 'rgba(55, 65, 81, 0.5)'
}
},
y: {
title: {
display: true,
text: 'Loss',
color: '#9CA3AF'
},
ticks: {
color: '#9CA3AF'
},
grid: {
color: 'rgba(55, 65, 81, 0.5)'
}
}
}
}
});
}
function initMetricsChart() {
const ctx = document.getElementById('metrics-chart').getContext('2d');
const chart = new Chart(ctx, {
type: 'line',
data: {
labels: Array.from({length: 20}, (_, i) => i * 5),
datasets: [
{
label: 'Accuracy',
data: [0.2, 0.3, 0.35, 0.4, 0.5, 0.6, 0.65, 0.7, 0.75, 0.78, 0.8, 0.82, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91],
borderColor: 'rgb(16, 185, 129)',
backgroundColor: 'rgba(16, 185, 129, 0.1)',
tension: 0.4,
fill: true
},
{
label: 'F1 Score',
data: [0.15, 0.25, 0.3, 0.35, 0.45, 0.55, 0.6, 0.65, 0.7, 0.73, 0.76, 0.78, 0.8, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88],
borderColor: 'rgb(245, 158, 11)',
backgroundColor: 'rgba(245, 158, 11, 0.1)',
tension: 0.4,
fill: true
}
]
},
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Performance Metrics',
color: '#E5E7EB'
},
legend: {
labels: {
color: '#E5E7EB'
}
}
},
scales: {
x: {
title: {
display: true,
text: 'Epoch',
color: '#9CA3AF'
},
ticks: {
color: '#9CA3AF'
},
grid: {
color: 'rgba(55, 65, 81, 0.5)'
}
},
y: {
title: {
display: true,
text: 'Score',
color: '#9CA3AF'
},
ticks: {
color: '#9CA3AF'
},
grid: {
color: 'rgba(55, 65, 81, 0.5)'
}
}
}
}
});
}
function makeNeuronsDraggable() {
const neurons = document.querySelectorAll('.draggable');
let isDragging = false;
let currentNeuron = null;
let offsetX, offsetY;
neurons.forEach(neuron => {
neuron.addEventListener('mousedown', function(e) {
isDragging = true;
currentNeuron = this;
offsetX = e.clientX - this.getBoundingClientRect().left;
offsetY = e.clientY - this.getBoundingClientRect().top;
// Bring to front
this.style.zIndex = '10';
this.classList.add('ring-2', 'ring-blue-400');
});
});
document.addEventListener('mousemove', function(e) {
if (!isDragging || !currentNeuron) return;
const container = document.getElementById('network-container');
const containerRect = container.getBoundingClientRect();
let x = e.clientX - containerRect.left - offsetX;
let y = e.clientY - containerRect.top - offsetY;
// Constrain to container
x = Math.max(0, Math.min(x, containerRect.width - currentNeuron.offsetWidth));
y = Math.max(0, Math.min(y, containerRect.height - currentNeuron.offsetHeight));
currentNeuron.style.left = `${x}px`;
currentNeuron.style.top = `${y}px`;
// Redraw connections
redrawConnections();
});
document.addEventListener('mouseup', function() {
if (currentNeuron) {
currentNeuron.style.zIndex = '';
currentNeuron.classList.remove('ring-2', 'ring-blue-400');
}
isDragging = false;
currentNeuron = null;
});
}
function redrawConnections() {
// Remove all existing connections
const connections = document.querySelectorAll('.connection');
connections.forEach(conn => conn.remove());
// Get all neurons
const neurons = document.querySelectorAll('.neuron');
const container = document.getElementById('network-container');
const containerRect = container.getBoundingClientRect();
// Recreate connections between consecutive layers
const layers = {};
neurons.forEach(neuron => {
const layer = parseInt(neuron.dataset.layer);
if (!layers[layer]) layers[layer] = [];
layers[layer].push(neuron);
});
const layerIndices = Object.keys(layers).sort();
for (let i = 0; i < layerIndices.length - 1; i++) {
const currentLayer = layers[layerIndices[i]];
const nextLayer = layers[layerIndices[i+1]];
currentLayer.forEach(startNeuron => {
nextLayer.forEach(endNeuron => {
const startRect = startNeuron.getBoundingClientRect();
const endRect = endNeuron.getBoundingClientRect();
const startX = startRect.left + startRect.width/2 - containerRect.left;
const startY = startRect.top + startRect.height/2 - containerRect.top;
const endX = endRect.left + endRect.width/2 - containerRect.left;
const endY = endRect.top + endRect.height/2 - containerRect.top;
const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
const angle = Math.atan2(endY - startY, endX - startX) * 180 / Math.PI;
const connection = document.createElement('div');
connection.className = 'connection';
connection.style.width = `${length}px`;
connection.style.height = '1px';
connection.style.left = `${startX}px`;
connection.style.top = `${startY}px`;
connection.style.transform = `rotate(${angle}deg)`;
// Randomly make some connections more visible to show weights
if (Math.random() < 0.3) {
connection.classList.add('active');
}
container.appendChild(connection);
});
});
}
}
function setupTabs() {
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons
tabButtons.forEach(btn => btn.classList.remove('active'));
// Add active class to clicked button
this.classList.add('active');
// Hide all tab contents
tabContents.forEach(content => content.classList.add('hidden'));
// Show the selected tab content
const tabId = this.getAttribute('data-tab') + '-tab';
document.getElementById(tabId).classList.remove('hidden');
});
});
}
function setupModelSelection() {
const modelCards = document.querySelectorAll('.model-card');
modelCards.forEach(card => {
card.addEventListener('click', function() {
// Remove selected class from all cards
modelCards.forEach(c => c.classList.remove('selected'));
// Add selected class to clicked card
this.classList.add('selected');
// Update network visualization based on selected model
const model = this.getAttribute('data-model');
updateNetworkForModel(model);
});
});
}
function updateNetworkForModel(model) {
let layers, colors, activations;
switch(model) {
case 'llama-2':
layers = [4, 8, 8, 4];
colors = ['bg-blue-500', 'bg-purple-500', 'bg-pink-500', 'bg-green-500'];
activations = ['sigmoid', 'relu', 'tanh', 'linear'];
break;
case 'gpt-3':
layers = [4, 12, 12, 4];
colors = ['bg-blue-500', 'bg-purple-500', 'bg-pink-500', 'bg-green-500'];
activations = ['relu', 'relu', 'tanh', 'linear'];
break;
case 'bert':
layers = [4, 8, 4];
colors = ['bg-blue-500', 'bg-purple-500', 'bg-green-500'];
activations = ['tanh', 'relu', 'linear'];
break;
default:
layers = [4, 8, 8, 4];
colors = ['bg-blue-500', 'bg-purple-500', 'bg-pink-500', 'bg-green-500'];
activations = ['sigmoid', 'relu', 'tanh', 'linear'];
}
drawNetwork(layers, colors, activations);
}
function setupLanguageSelection() {
const languageTags = document.querySelectorAll('.language-tag');
languageTags.forEach(tag => {
tag.addEventListener('click', function() {
// Toggle selected class
this.classList.toggle('selected');
// If Swahili is selected, show special message
if (this.getAttribute('data-lang') === 'sw' && this.classList.contains('selected')) {
showSwahiliMessage();
}
});
});
}
function showSwahiliMessage() {
const fineTuningTab = document.getElementById('fine-tuning-tab');
const message = document.createElement('div');
message.className = 'bg-blue-900 text-blue-200 p-3 rounded-lg text-sm mb-4 flex items-start';
message.innerHTML = `
<i class="fas fa-info-circle mt-1 mr-2"></i>
<div>
<strong>Kumbuka:</strong> Unachagua kufanya fine-tuning kwa lugha ya Kiswahili.
Hii itahitaji data ya ziada ya Kiswahili kwa matokeo bora.
<div class="mt-1">Tafadhali hakikisha una dataset ya kutosha.</div>
</div>
`;
fineTuningTab.insertBefore(message, fineTuningTab.firstChild.nextSibling);
// Remove after 10 seconds
setTimeout(() => {
message.remove();
}, 10000);
}
function updateSliderValues() {
const sliders = document.querySelectorAll('.param-slider');
sliders.forEach(slider => {
const valueDisplay = slider.nextElementSibling;
// Update display initially
valueDisplay.textContent = slider.value;
// Update display when slider changes
slider.addEventListener('input', function() {
valueDisplay.textContent = this.value;
});
});
}
function simulateTraining() {
const startButton = document.querySelector('.bg-green-600');
const pauseButton = document.querySelector('.bg-yellow-600');
const stopButton = document.querySelector('.bg-red-600');
const epochDisplay = document.querySelector('.text-2xl.font-bold.text-center');
const trainingLossDisplay = document.querySelectorAll('.text-2xl.font-bold.text-center')[1];
const valLossDisplay = document.querySelectorAll('.text-2xl.font-bold.text-center')[2];
const progressBars = document.querySelectorAll('.bg-gray-700 .rounded-full > div');
let isTraining = false;
let isPaused = false;
let currentEpoch = 0;
let animationId;
startButton.addEventListener('click', function() {
if (!isTraining) {
isTraining = true;
currentEpoch = 0;
startButton.disabled = true;
pauseButton.disabled = false;
stopButton.disabled = false;
// Change button text
startButton.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Training...';
// Start training animation
simulateEpoch();
}
});
pauseButton.addEventListener('click', function() {
if (isTraining && !isPaused) {
isPaused = true;
cancelAnimationFrame(animationId);
pauseButton.innerHTML = '<i class="fas fa-play mr-2"></i> Resume';
startButton.innerHTML = '<i class="fas fa-spinner mr-2"></i> Training Paused';
} else if (isTraining && isPaused) {
isPaused = false;
pauseButton.innerHTML = '<i class="fas fa-pause mr-2"></i> Pause';
startButton.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Training...';
simulateEpoch();
}
});
stopButton.addEventListener('click', function() {
isTraining = false;
isPaused = false;
cancelAnimationFrame(animationId);
startButton.disabled = false;
pauseButton.disabled = true;
stopButton.disabled = true;
startButton.innerHTML = '<i class="fas fa-play mr-2"></i> Start Training';
pauseButton.innerHTML = '<i class="fas fa-pause mr-2"></i> Pause';
// Reset progress bars
progressBars.forEach(bar => {
bar.style.width = '0%';
});
});
function simulateEpoch() {
if (!isTraining || isPaused) return;
currentEpoch++;
// Update displays
epochDisplay.textContent = currentEpoch;
// Simulate decreasing loss
const trainingLoss = Math.max(0.1, 2.5 - (currentEpoch * 0.12));
const valLoss = Math.max(0.15, 2.6 - (currentEpoch * 0.115));
trainingLossDisplay.textContent = trainingLoss.toFixed(4);
valLossDisplay.textContent = valLoss.toFixed(4);
// Update progress bars after 5 epochs
if (currentEpoch >= 5) {
const progress = Math.min(100, (currentEpoch - 5) * 10);
progressBars.forEach(bar => {
bar.style.width = `${progress}%`;
});
}
// Continue until 20 epochs
if (currentEpoch < 20) {
animationId = requestAnimationFrame(simulateEpoch);
} else {
isTraining = false;
startButton.disabled = false;
pauseButton.disabled = true;
stopButton.disabled = true;
startButton.innerHTML = '<i class="fas fa-play mr-2"></i> Start Training';
// Show completion message
const message = document.createElement('div');
message.className = 'bg-green-900 text-green-200 p-3 rounded-lg text-sm mb-4 flex items-center absolute bottom-4 right-4';
message.innerHTML = `
<i class="fas fa-check-circle mr-2"></i>
<div>Training completed successfully!</div>
`;
document.querySelector('.flex-1.overflow-auto').appendChild(message);
// Remove after 5 seconds
setTimeout(() => {
message.remove();
}, 5000);
}
}
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Bur3hani/neuralv" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |