mulliken commited on
Commit
3d09990
·
verified ·
1 Parent(s): b916611

Upload CWE_Predictor.ipynb with huggingface_hub

Browse files
Files changed (1) hide show
  1. CWE_Predictor.ipynb +57 -32
CWE_Predictor.ipynb CHANGED
@@ -620,7 +620,7 @@
620
  },
621
  {
622
  "cell_type": "code",
623
- "execution_count": null,
624
  "id": "4b087fae",
625
  "metadata": {},
626
  "outputs": [
@@ -630,8 +630,8 @@
630
  "\n",
631
  " <div>\n",
632
  " \n",
633
- " <progress value='4453' max='6978' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
634
- " [4453/6978 50:27 < 28:37, 1.47 it/s, Epoch 0.64/1]\n",
635
  " </div>\n",
636
  " <table border=\"1\" class=\"dataframe\">\n",
637
  " <thead>\n",
@@ -672,6 +672,20 @@
672
  " <td>0.720193</td>\n",
673
  " <td>0.242404</td>\n",
674
  " </tr>\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  " </tbody>\n",
676
  "</table><p>"
677
  ],
@@ -681,6 +695,16 @@
681
  },
682
  "metadata": {},
683
  "output_type": "display_data"
 
 
 
 
 
 
 
 
 
 
684
  }
685
  ],
686
  "source": [
@@ -689,7 +713,7 @@
689
  },
690
  {
691
  "cell_type": "code",
692
- "execution_count": 30,
693
  "id": "48faf17c",
694
  "metadata": {},
695
  "outputs": [],
@@ -705,37 +729,31 @@
705
  },
706
  {
707
  "cell_type": "code",
708
- "execution_count": 31,
709
  "id": "fcb11390",
710
  "metadata": {},
711
  "outputs": [
712
  {
713
  "data": {
714
  "application/vnd.jupyter.widget-view+json": {
715
- "model_id": "80b4e05d305a419796600df308bf989c",
716
  "version_major": 2,
717
  "version_minor": 0
718
  },
719
  "text/plain": [
720
- "model.safetensors: 0%| | 0.00/269M [00:00<?, ?B/s]"
721
  ]
722
  },
723
  "metadata": {},
724
  "output_type": "display_data"
725
  },
726
  {
727
- "data": {
728
- "application/vnd.jupyter.widget-view+json": {
729
- "model_id": "63312fcfde9d426f94ff7f17afd68049",
730
- "version_major": 2,
731
- "version_minor": 0
732
- },
733
- "text/plain": [
734
- "README.md: 0.00B [00:00, ?B/s]"
735
- ]
736
- },
737
- "metadata": {},
738
- "output_type": "display_data"
739
  },
740
  {
741
  "name": "stdout",
@@ -759,19 +777,10 @@
759
  },
760
  {
761
  "cell_type": "code",
762
- "execution_count": null,
763
  "id": "33847880",
764
  "metadata": {},
765
- "outputs": [
766
- {
767
- "name": "stdout",
768
- "output_type": "stream",
769
- "text": [
770
- "CWE-119\n",
771
- "CWE-89\n"
772
- ]
773
- }
774
- ],
775
  "source": [
776
  "# Load the model\n",
777
  "model = AutoModelForSequenceClassification.from_pretrained(\"artifacts/model\")\n",
@@ -790,10 +799,26 @@
790
  },
791
  {
792
  "cell_type": "code",
793
- "execution_count": null,
794
  "id": "cdeaadbb",
795
  "metadata": {},
796
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  "source": [
798
  "\n",
799
  "print(predict_cwe(\"Buffer overflow in POP servers allows remote attackers to gain root access using a long PASS command.\"))\n",
 
620
  },
621
  {
622
  "cell_type": "code",
623
+ "execution_count": 32,
624
  "id": "4b087fae",
625
  "metadata": {},
626
  "outputs": [
 
630
  "\n",
631
  " <div>\n",
632
  " \n",
633
+ " <progress value='6978' max='6978' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
634
+ " [6978/6978 1:18:31, Epoch 1/1]\n",
635
  " </div>\n",
636
  " <table border=\"1\" class=\"dataframe\">\n",
637
  " <thead>\n",
 
672
  " <td>0.720193</td>\n",
673
  " <td>0.242404</td>\n",
674
  " </tr>\n",
675
+ " <tr>\n",
676
+ " <td>5000</td>\n",
677
+ " <td>1.110300</td>\n",
678
+ " <td>1.111053</td>\n",
679
+ " <td>0.722934</td>\n",
680
+ " <td>0.244389</td>\n",
681
+ " </tr>\n",
682
+ " <tr>\n",
683
+ " <td>6000</td>\n",
684
+ " <td>1.134700</td>\n",
685
+ " <td>1.082806</td>\n",
686
+ " <td>0.727207</td>\n",
687
+ " <td>0.251264</td>\n",
688
+ " </tr>\n",
689
  " </tbody>\n",
690
  "</table><p>"
691
  ],
 
695
  },
696
  "metadata": {},
697
  "output_type": "display_data"
698
+ },
699
+ {
700
+ "data": {
701
+ "text/plain": [
702
+ "TrainOutput(global_step=6978, training_loss=1.1011348515535433, metrics={'train_runtime': 4712.2885, 'train_samples_per_second': 23.691, 'train_steps_per_second': 1.481, 'total_flos': 2912105519756448.0, 'train_loss': 1.1011348515535433, 'epoch': 1.0})"
703
+ ]
704
+ },
705
+ "execution_count": 32,
706
+ "metadata": {},
707
+ "output_type": "execute_result"
708
  }
709
  ],
710
  "source": [
 
713
  },
714
  {
715
  "cell_type": "code",
716
+ "execution_count": 33,
717
  "id": "48faf17c",
718
  "metadata": {},
719
  "outputs": [],
 
729
  },
730
  {
731
  "cell_type": "code",
732
+ "execution_count": 34,
733
  "id": "fcb11390",
734
  "metadata": {},
735
  "outputs": [
736
  {
737
  "data": {
738
  "application/vnd.jupyter.widget-view+json": {
739
+ "model_id": "a33b852d1c594a69974bb9c3d30c014a",
740
  "version_major": 2,
741
  "version_minor": 0
742
  },
743
  "text/plain": [
744
+ "README.md: 0.00B [00:00, ?B/s]"
745
  ]
746
  },
747
  "metadata": {},
748
  "output_type": "display_data"
749
  },
750
  {
751
+ "name": "stderr",
752
+ "output_type": "stream",
753
+ "text": [
754
+ "No files have been modified since last commit. Skipping to prevent empty commit.\n",
755
+ "No files have been modified since last commit. Skipping to prevent empty commit.\n"
756
+ ]
 
 
 
 
 
 
757
  },
758
  {
759
  "name": "stdout",
 
777
  },
778
  {
779
  "cell_type": "code",
780
+ "execution_count": 35,
781
  "id": "33847880",
782
  "metadata": {},
783
+ "outputs": [],
 
 
 
 
 
 
 
 
 
784
  "source": [
785
  "# Load the model\n",
786
  "model = AutoModelForSequenceClassification.from_pretrained(\"artifacts/model\")\n",
 
799
  },
800
  {
801
  "cell_type": "code",
802
+ "execution_count": 36,
803
  "id": "cdeaadbb",
804
  "metadata": {},
805
+ "outputs": [
806
+ {
807
+ "name": "stdout",
808
+ "output_type": "stream",
809
+ "text": [
810
+ "CWE-119\n",
811
+ "CWE-89\n",
812
+ "CWE-79\n",
813
+ "CWE-287\n",
814
+ "CWE-22\n",
815
+ "CWE-190\n",
816
+ "CWE-401\n",
817
+ "CWE-77\n",
818
+ "CWE-326\n"
819
+ ]
820
+ }
821
+ ],
822
  "source": [
823
  "\n",
824
  "print(predict_cwe(\"Buffer overflow in POP servers allows remote attackers to gain root access using a long PASS command.\"))\n",