File size: 49,391 Bytes
8a7fcc7 |
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 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "A100",
"machine_shape": "hm"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"531def06b1f7430983a2e4ba33f41f7f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_847b6b899bfc4e9b89b6ecb136a21385",
"IPY_MODEL_412da2e9912f4eb0ab89d44f0bb09cec",
"IPY_MODEL_1d56fddc294241f6a7cb4a300cb09afd"
],
"layout": "IPY_MODEL_6f83c639357f4729873f6897119532f0"
}
},
"847b6b899bfc4e9b89b6ecb136a21385": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2551b382eca04537a3a11cd70aaf574c",
"placeholder": "",
"style": "IPY_MODEL_93e6cbabc77f4fd69ddc3dee9012cb8e",
"value": "Loading checkpoint shards: 100%"
}
},
"412da2e9912f4eb0ab89d44f0bb09cec": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_da2997c847b84a32b43c377137f64b5e",
"max": 4,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_24f16c1efe8547f1ab36efcccda46b59",
"value": 4
}
},
"1d56fddc294241f6a7cb4a300cb09afd": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_cc8cb81531344463aa881093fff8c2f0",
"placeholder": "",
"style": "IPY_MODEL_f4c45b260e7a4feaaeef4c50c560641a",
"value": " 4/4 [00:12<00:00, 2.77s/it]"
}
},
"6f83c639357f4729873f6897119532f0": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2551b382eca04537a3a11cd70aaf574c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"93e6cbabc77f4fd69ddc3dee9012cb8e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"da2997c847b84a32b43c377137f64b5e": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"24f16c1efe8547f1ab36efcccda46b59": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"cc8cb81531344463aa881093fff8c2f0": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"f4c45b260e7a4feaaeef4c50c560641a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"0272ba7f31a2441ab1cb5b8f77dbaacb": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_d1bb171ddebd4f4bbeb4ed5d4b8b7076",
"IPY_MODEL_33b4fc55703746778511265e28160837",
"IPY_MODEL_7548c151f8764276ad7951e2ac80d981"
],
"layout": "IPY_MODEL_d972c72fef7c45998469550318661e71"
}
},
"d1bb171ddebd4f4bbeb4ed5d4b8b7076": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2811b7c68a7b4c95b91bd5690cf06577",
"placeholder": "",
"style": "IPY_MODEL_a33ccfdb735948e98a19d901d8091319",
"value": "Loading checkpoint shards: 100%"
}
},
"33b4fc55703746778511265e28160837": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_c1103244cec74a299265729e630faffd",
"max": 4,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_340941cfc49e4ab983b73fb48c30dfe8",
"value": 4
}
},
"7548c151f8764276ad7951e2ac80d981": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_8bb42aa84f4b4a9ab6417aed92132063",
"placeholder": "",
"style": "IPY_MODEL_b0cf428afc21468caeb664428627aaf6",
"value": " 4/4 [00:11<00:00, 2.57s/it]"
}
},
"d972c72fef7c45998469550318661e71": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2811b7c68a7b4c95b91bd5690cf06577": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a33ccfdb735948e98a19d901d8091319": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"c1103244cec74a299265729e630faffd": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"340941cfc49e4ab983b73fb48c30dfe8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"8bb42aa84f4b4a9ab6417aed92132063": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b0cf428afc21468caeb664428627aaf6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
}
}
}
},
"cells": [
{
"cell_type": "code",
"source": [
"!pip install -U bitsandbytes transformers peft accelerate trl datasets sentencepiece wandb\n",
"!pip install flash-attn --no-build-isolation"
],
"metadata": {
"id": "tg1moVggj5sk",
"collapsed": true
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"MODEL_NAME = \"CohereForAI/aya-23-8b\"\n",
"\n",
"# you may want to change the following parameters depending on your GPU configuration\n",
"\n",
"# free T4 instance\n",
"# QUANTIZE_4BIT = True\n",
"# USE_GRAD_CHECKPOINTING = True\n",
"# TRAIN_BATCH_SIZE = 2\n",
"# TRAIN_MAX_SEQ_LENGTH = 512\n",
"# USE_FLASH_ATTENTION = False\n",
"# GRAD_ACC_STEPS = 16\n",
"\n",
"# equivalent A100 setting\n",
"QUANTIZE_4BIT = True\n",
"USE_GRAD_CHECKPOINTING = True\n",
"TRAIN_BATCH_SIZE = 16\n",
"TRAIN_MAX_SEQ_LENGTH = 512\n",
"USE_FLASH_ATTENTION = True\n",
"GRAD_ACC_STEPS = 2"
],
"metadata": {
"id": "Izn6BYEYw4um"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig,HfArgumentParser,TrainingArguments,pipeline, logging\n",
"from peft import LoraConfig, PeftModel, prepare_model_for_kbit_training, get_peft_model\n",
"import os,torch\n",
"import bitsandbytes as bnb\n",
"from datasets import load_dataset\n",
"from trl import SFTTrainer\n",
"from datasets import Dataset\n",
"import pyarrow as pa\n",
"import pyarrow.dataset as ds\n",
"import pandas as pd\n",
"import re\n",
"import wandb"
],
"metadata": {
"id": "wMs9uNDMHL6R"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Load Model\n",
"quantization_config = None\n",
"if QUANTIZE_4BIT:\n",
" quantization_config = BitsAndBytesConfig(\n",
" load_in_4bit=True,\n",
" bnb_4bit_quant_type=\"nf4\",\n",
" bnb_4bit_use_double_quant=True,\n",
" bnb_4bit_compute_dtype=torch.bfloat16,\n",
" )\n",
"\n",
"attn_implementation = None\n",
"if USE_FLASH_ATTENTION:\n",
" attn_implementation=\"flash_attention_2\"\n",
"\n",
"model = AutoModelForCausalLM.from_pretrained(\n",
" MODEL_NAME,\n",
" quantization_config=quantization_config,\n",
" attn_implementation=attn_implementation,\n",
" torch_dtype=torch.bfloat16,\n",
" device_map=\"auto\",\n",
" )"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 176,
"referenced_widgets": [
"531def06b1f7430983a2e4ba33f41f7f",
"847b6b899bfc4e9b89b6ecb136a21385",
"412da2e9912f4eb0ab89d44f0bb09cec",
"1d56fddc294241f6a7cb4a300cb09afd",
"6f83c639357f4729873f6897119532f0",
"2551b382eca04537a3a11cd70aaf574c",
"93e6cbabc77f4fd69ddc3dee9012cb8e",
"da2997c847b84a32b43c377137f64b5e",
"24f16c1efe8547f1ab36efcccda46b59",
"cc8cb81531344463aa881093fff8c2f0",
"f4c45b260e7a4feaaeef4c50c560641a"
]
},
"id": "d9a23_jiC-qG",
"outputId": "3cf0666d-f23d-4382-b17b-c29cbe91d2f6"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:89: UserWarning: \n",
"The secret `HF_TOKEN` does not exist in your Colab secrets.\n",
"To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n",
"You will be able to reuse this secret in all of your notebooks.\n",
"Please note that authentication is recommended but still optional to access public models or datasets.\n",
" warnings.warn(\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "531def06b1f7430983a2e4ba33f41f7f"
}
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# Load tokenizer\n",
"tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "YuqAA8GhYSdO",
"outputId": "14553887-8142-492e-ca23-aeddac002815"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"def get_message_format(prompts):\n",
" messages = []\n",
"\n",
" for p in prompts:\n",
" messages.append(\n",
" [{\"role\": \"user\", \"content\": p}]\n",
" )\n",
"\n",
" return messages\n",
"\n",
"def generate_aya_23(\n",
" prompts,\n",
" model,\n",
" temperature=0.3,\n",
" top_p=0.75,\n",
" top_k=0,\n",
" max_new_tokens=1024\n",
" ):\n",
"\n",
" messages = get_message_format(prompts)\n",
"\n",
" input_ids = tokenizer.apply_chat_template(\n",
" messages,\n",
" tokenize=True,\n",
" add_generation_prompt=True,\n",
" padding=True,\n",
" return_tensors=\"pt\",\n",
" )\n",
" input_ids = input_ids.to(model.device)\n",
" prompt_padded_len = len(input_ids[0])\n",
"\n",
" gen_tokens = model.generate(\n",
" input_ids,\n",
" temperature=temperature,\n",
" top_p=top_p,\n",
" top_k=top_k,\n",
" max_new_tokens=max_new_tokens,\n",
" do_sample=True,\n",
" )\n",
"\n",
" # get only generated tokens\n",
" gen_tokens = [\n",
" gt[prompt_padded_len:] for gt in gen_tokens\n",
" ]\n",
"\n",
" gen_text = tokenizer.batch_decode(gen_tokens, skip_special_tokens=True)\n",
" return gen_text"
],
"metadata": {
"id": "s75a8Vda-eqx"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Test generations on langauges in Aya 23 set\n",
"prompts = [\n",
" \"Write a list of three fruits and tell me about each of them\", # English\n",
" \"Viết danh sách ba loại trái cây và kể cho tôi nghe về từng loại trái cây đó\", # Vietnamese\n",
" \"3 つの果物のリストを書いて、それぞれについて教えてください\", # Japanese\n",
" \"Üç meyveden oluşan bir liste yazın ve bana her birini anlatın\" # Turkish\n",
"]\n",
"\n",
"generations = generate_aya_23(prompts, model)\n",
"\n",
"for p, g in zip(prompts, generations):\n",
" print(\n",
" \"PROMPT\", p ,\"RESPONSE\", g, \"\\n\", sep=\"\\n\"\n",
" )"
],
"metadata": {
"id": "4l12EC7q-h3I",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "e32ee1a4-9d91-447f-9bde-c8c71c727d80"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"PROMPT\n",
"Write a list of three fruits and tell me about each of them\n",
"RESPONSE\n",
"Sure! Here is a list of three fruits, along with some information about each of them:\n",
"\n",
"1. Apple: Apples are a popular fruit that are widely cultivated across the world. They are typically round or oval in shape and come in a variety of colors, including red, green, yellow, and a blend of these colors. Apples are known for their crisp texture and sweet or tart taste. They are a good source of dietary fiber, vitamins, and antioxidants.\n",
"\n",
"2. Banana: Bananas are long, curved fruits that come in a range of colors, from yellow to brown. They are a good source of potassium, vitamins, and fiber. Bananas have a sweet taste and are often eaten raw, but they can also be used in baking or blended into smoothies.\n",
"\n",
"3. Orange: Oranges are citrus fruits known for their vibrant orange color and sweet, tangy taste. They are a good source of vitamin C and other nutrients. Oranges can be eaten fresh, juiced, or used in various dishes, such as salads, desserts, and marmalades.\n",
"\n",
"These fruits are not only delicious but also provide various health benefits and are commonly used in various cuisines worldwide.\n",
"\n",
"\n",
"PROMPT\n",
"Viết danh sách ba loại trái cây và kể cho tôi nghe về từng loại trái cây đó\n",
"RESPONSE\n",
"Dưới đây là ba loại trái cây phổ biến, mỗi loại có hương vị và đặc điểm riêng:\n",
"\n",
"1. Táo: Táo là một loại trái cây quen thuộc và phổ biến trên toàn thế giới. Chúng có nguồn gốc từ Châu Á nhưng hiện nay được trồng ở nhiều nơi. Táo có hình tròn hoặc oval, với nhiều loại khác nhau về kích thước và màu sắc. Vỏ táo có thể có màu đỏ, xanh hoặc vàng, trong khi phần thịt thường có màu trắng hoặc hồng nhạt. Táo có hương vị ngọt ngào và tươi mát, với một chút giòn khi ăn. Chúng chứa nhiều vitamin và chất xơ, làm cho táo trở thành một món ăn vặt lành mạnh. Táo cũng thường được sử dụng trong các món tráng miệng và nước ép.\n",
"\n",
"2. Cam: Cam là một loại trái cây nhiệt đới có nguồn gốc từ Châu Phi và hiện nay được trồng rộng rãi trên toàn thế giới. Chúng có hình tròn hoặc oval, với vỏ cam hoặc vàng và thịt màu cam tươi sáng. Cam có hương vị ngọt ngào và chua nhẹ, với một chút giòn khi ăn. Chúng chứa nhiều vitamin C và có thể được ăn tươi hoặc ép lấy nước. Cam cũng thường được sử dụng trong các món salad, nước ép và các món tráng miệng.\n",
"\n",
"3. Dâu tây: Dâu tây là một loại trái cây mọng nước có nguồn gốc từ Châu Âu và hiện nay được trồng rộng rãi trên toàn thế giới. Chúng có hình tròn hoặc oval, với màu đỏ tươi hoặc hồng nhạt và thịt trắng hoặc hồng nhạt. Dâu tây có hương vị ngọt ngào và tươi mát, với một chút giòn. Chúng thường được sử dụng trong các món tráng miệng, bánh ngọt và salad. Dâu tây cũng chứa nhiều vitamin và chất chống oxy hóa, làm cho chúng trở thành một lựa chọn lành mạnh.\n",
"\n",
"Mỗi loại trái cây này đều có hương vị và đặc điểm riêng, nhưng tất cả đều là những lựa chọn lành mạnh và ngon miệng cho bữa ăn nhẹ hoặc món tráng miệng.\n",
"\n",
"\n",
"PROMPT\n",
"3 つの果物のリストを書いて、それぞれについて教えてください\n",
"RESPONSE\n",
"もちろんです! 3 つの果物は次のとおりです。\n",
"\n",
"1. リンゴ: リンゴは世界中で広く栽培されている人気のある果物です。甘くてジューシーな味と食感で知られ、赤、緑、黄色などさまざまな品種があります。リンゴはビタミンや食物繊維が豊富で、健康的なスナックとしてよく食べられています。\n",
"\n",
"2. オレンジ: オレンジは柑橘類の一種で、ビタミン C が豊富に含まれています。甘酸っぱい味わいとジューシーな食感が特徴で、世界中で広く消費されています。オレンジは免疫力を高め、健康な皮膚と髪を維持するのに役立つと考えられています。\n",
"\n",
"3. スターフルーツ: スターフルーツは、その名前が示すように、星形をした独特の形をした果物です。甘くて爽やかな味わいで、ビタミン C と食物繊維が豊富です。スターフルーツは通常、生として食べられますが、ジュースやデザートにも使われます。\n",
"\n",
"これらの果物はすべて、栄養価が高く、さまざまな健康上の利点を提供します。世界中で広く利用可能で、さまざまな方法で楽しむことができます。\n",
"\n",
"\n",
"PROMPT\n",
"Üç meyveden oluşan bir liste yazın ve bana her birini anlatın\n",
"RESPONSE\n",
"Elma, armut ve çilek.\n",
"\n",
"Elma: Elma, dünyanın birçok bölgesinde yetişen popüler ve yaygın bir meyvedir. Genellikle kırmızı veya yeşil kabuğu ve sulu, tatlı eti vardır. Elma, vitamin C ve lif bakımından zengindir ve sağlıklı bir atıştırmalık olarak kabul edilir.\n",
"\n",
"Armut: Armut, yaz aylarında hasat edilen ve genellikle sarı, yeşil veya mor renkte olan bir meyvedir. Armut, elmaya benzer bir tada sahiptir, ancak daha yumuşak ve sulu bir dokuya sahiptir. Armut da vitamin C ve K bakımından zengindir ve sindirimi kolay bir meyve olarak bilinir.\n",
"\n",
"Çilek: Çilek, bahar ve yaz aylarında hasat edilen ve tatlı ve aromatik bir tada sahip kırmızı meyvelerdir. Çilekler genellikle taze olarak yenir, ancak dondurulmuş veya kurutulmuş olarak da tüketilebilir. Vitamin C ve antioksidanlar bakımından zengindir ve kalp sağlığını destekleyebileceği düşünülmektedir.\n",
"\n",
"Bu üç meyve, her birinin kendine has özellikleri ve faydaları olan lezzetli ve besleyici seçenekler sunar.\n",
"\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Test Bengali (not in Aya 23 set) inference on base model\n",
"\n",
"prompts = [\n",
" 'Translate from English to Bengali: \"Rates are competitive, almost always the best in the market\"'\n",
"]\n",
"\n",
"generations = generate_aya_23(prompts, model)\n",
"\n",
"for p, g in zip(prompts, generations):\n",
" print(\n",
" \"PROMPT\", p ,\"RESPONSE\", g, \"\\n\", sep=\"\\n\"\n",
" )"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "tkEl3__Mwd8N",
"outputId": "d4cf3e07-f148-4a57-cd69-b72acfc15b54"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"PROMPT\n",
"Translate from English to Bengali: \"Rates are competitive, almost always the best in the market\"\n",
"RESPONSE\n",
"\"পরিণতি সংসাধানকরি, বাজারের সম্পর্কে সম্প্রতি সবচেয়ে বেশি\"\n",
"\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# Load an English to Bengali translation dataset from Aya Collection\n",
"dataset = load_dataset(\"CohereForAI/aya_collection\", \"templated_indic_sentiment\")['train']\n",
"dataset = dataset.filter(lambda example: example['language']=='ben')\n",
"\n",
"def formatting_prompts_func(example):\n",
" output_texts = []\n",
" for i in range(len(example['inputs'])):\n",
" text = f\"<|START_OF_TURN_TOKEN|><|USER_TOKEN|>{example['inputs'][i]}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{example['targets'][i]}\"\n",
" output_texts.append(text)\n",
" return output_texts"
],
"metadata": {
"id": "CHXm3Io5zCrk"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Training Arguments\n",
"training_arguments = TrainingArguments(\n",
" output_dir=\"results\",\n",
" num_train_epochs=20,\n",
" per_device_train_batch_size=TRAIN_BATCH_SIZE,\n",
" gradient_accumulation_steps=GRAD_ACC_STEPS,\n",
" gradient_checkpointing=USE_GRAD_CHECKPOINTING,\n",
" optim=\"paged_adamw_32bit\",\n",
" save_steps=50,\n",
" logging_steps=10,\n",
" learning_rate=1e-3,\n",
" weight_decay=0.001,\n",
" fp16=False,\n",
" bf16=True,\n",
" warmup_ratio=0.05,\n",
" group_by_length=True,\n",
" lr_scheduler_type=\"constant\",\n",
" report_to=\"none\"\n",
")\n",
"\n",
"peft_config = LoraConfig(\n",
" lora_alpha=32,\n",
" r=32,\n",
" bias=\"none\",\n",
" task_type=\"CAUSAL_LM\",\n",
" target_modules=[\"q_proj\", \"v_proj\", \"k_proj\", \"o_proj\"]\n",
")\n",
"\n",
"trainer = SFTTrainer(\n",
" model=model,\n",
" train_dataset=dataset,\n",
" peft_config=peft_config,\n",
" max_seq_length=TRAIN_MAX_SEQ_LENGTH,\n",
" tokenizer=tokenizer,\n",
" args=training_arguments,\n",
" formatting_func=formatting_prompts_func\n",
")"
],
"metadata": {
"id": "A9OdyDDEy7rM",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "49592f25-4aaf-4e21-f612-a6fe5c5865e1"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.10/dist-packages/trl/trainer/sft_trainer.py:318: UserWarning: You passed a tokenizer with `padding_side` not equal to `right` to the SFTTrainer. This might lead to some unexpected behaviour due to overflow issues when training a model in half-precision. You might consider adding `tokenizer.padding_side = 'right'` to your code.\n",
" warnings.warn(\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"trainer.train()"
],
"metadata": {
"id": "9BvK-3eYiwhx"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Save the model to disk\n",
"trainer.model.save_pretrained(save_directory='aya-qlora')\n",
"model.config.use_cache = True\n",
"model.eval()"
],
"metadata": {
"id": "X3Lqfwo-8CCG"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Test Bengali inference on loaded fine-tuned model\n",
"\n",
"# Load Model and LoRA Adapter\n",
"quantization_config = None\n",
"if QUANTIZE_4BIT:\n",
" quantization_config = BitsAndBytesConfig(\n",
" load_in_4bit=True,\n",
" bnb_4bit_quant_type=\"nf4\",\n",
" bnb_4bit_use_double_quant=True,\n",
" bnb_4bit_compute_dtype=torch.bfloat16,\n",
" )\n",
"\n",
"attn_implementation = None\n",
"if USE_FLASH_ATTENTION:\n",
" attn_implementation=\"flash_attention_2\"\n",
"\n",
"loaded_model = AutoModelForCausalLM.from_pretrained(\n",
" MODEL_NAME,\n",
" quantization_config=quantization_config,\n",
" attn_implementation=attn_implementation,\n",
" torch_dtype=torch.bfloat16,\n",
" device_map=\"auto\",\n",
" )\n",
"tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)\n",
"loaded_model.load_adapter(\"aya-qlora\")\n",
"\n",
"\n",
"prompts = [\n",
" 'Translate from English to Bengali: \"Rates are competitive, almost always the best in the market\"'\n",
"]\n",
"\n",
"generations = generate_aya_23(prompts, loaded_model)\n",
"\n",
"for p, g in zip(prompts, generations):\n",
" print(\n",
" \"PROMPT\", p ,\"RESPONSE\", g, \"\\n\", sep=\"\\n\"\n",
" )"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 174,
"referenced_widgets": [
"0272ba7f31a2441ab1cb5b8f77dbaacb",
"d1bb171ddebd4f4bbeb4ed5d4b8b7076",
"33b4fc55703746778511265e28160837",
"7548c151f8764276ad7951e2ac80d981",
"d972c72fef7c45998469550318661e71",
"2811b7c68a7b4c95b91bd5690cf06577",
"a33ccfdb735948e98a19d901d8091319",
"c1103244cec74a299265729e630faffd",
"340941cfc49e4ab983b73fb48c30dfe8",
"8bb42aa84f4b4a9ab6417aed92132063",
"b0cf428afc21468caeb664428627aaf6"
]
},
"id": "w5HGIJtRJN-y",
"outputId": "441193fe-89fa-40ad-8585-d1f2dcf124e5"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "0272ba7f31a2441ab1cb5b8f77dbaacb"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"PROMPT\n",
"Translate from English to Bengali: \"Rates are competitive, almost always the best in the market\"\n",
"RESPONSE\n",
"\"দরগুলি প্রতিযোগিতামূলক, প্রায় সবসময় বাজারে সেরা\"\n",
"\n",
"\n"
]
}
]
}
]
} |