Sumeetgpt commited on
Commit
319fffd
·
verified ·
1 Parent(s): 8a09d4c

Push model using huggingface_hub.

Browse files
Files changed (2) hide show
  1. README.md +2 -92
  2. config_setfit.json +2 -2
README.md CHANGED
@@ -4,40 +4,12 @@ tags:
4
  - sentence-transformers
5
  - text-classification
6
  - generated_from_setfit_trainer
7
- widget:
8
- - text: "Analyze this clean_code: perms = models.Permission.objects.filter(\n \
9
- \ codename__in=(\"add_customuser\", \"change_customuser\")\n )\n\
10
- \ user.user_permissions.add(*perms)\n request = self.factory.get(\"\
11
- /rand\")\n request.user = user"
12
- - text: 'Analyze this hardcoded_secret: SECRET_KEY = "super-secret-jwt-key-do-not-share" #
13
- Django production secret'
14
- - text: "columns_str = ', '.join(BOOKMARK_COLUMNS)\n curs.execute('SELECT ' + columns_str\
15
- \ + ' FROM bookmarks ' + where_clause\\"
16
- - text: 'Analyze this hardcoded_secret: const db = new Pool({ password: ''Pr0duct10n#2024''
17
- });'
18
- - text: "Analyze this hardcoded_secret: name: \"Blake2b with 'Hello, World!'\"\
19
- ,\n\t\t\thasher: NewBlake2B(),\n\t\t\tinput: []byte(\"Hello, World!\"\
20
- ),\n\t\t\texpectedHex: \"511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03\"\
21
- ,\n\t\t},\n\t\t{\n\t\t\tname: \"Blake2b input at max size\","
22
  metrics:
23
  - accuracy
24
  pipeline_tag: text-classification
25
  library_name: setfit
26
  inference: true
27
- model-index:
28
- - name: SetFit
29
- results:
30
- - task:
31
- type: text-classification
32
- name: Text Classification
33
- dataset:
34
- name: Unknown
35
- type: unknown
36
- split: test
37
- metrics:
38
- - type: accuracy
39
- value: 0.9760765550239234
40
- name: Accuracy
41
  ---
42
 
43
  # SetFit
@@ -67,21 +39,6 @@ The model has been trained using an efficient few-shot learning technique that i
67
  - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
68
  - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
69
 
70
- ### Model Labels
71
- | Label | Examples |
72
- |:-----------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
73
- | SAFE_CODE | <ul><li>'Analyze this clean_code: },\n "summary": "Read Items",\n "operationId": "read_items_items__get",\n "security": [{"OAuth2PasswordBearer": []}],'</li><li>'Analyze this clean_code: :license: Apache 2.0, see LICENSE for more details.\n"""\n\nfrom __future__ import annotations\n\nimport warnings'</li><li>'Analyze this clean_code: it \'sets rel to stylesheet\' do\n get \'/style\'\n expect(headers[\'Link\']).to include(\'rel="stylesheet"\')\n end\n\n it \'returns html tag\' do'</li></ul> |
74
- | VULNERABLE_LOGIC | <ul><li>'try {\n await exec(`${ezu} apikey-get --apikey hello`);'</li><li>"Analyze this vulnerable_pattern: $user = $_GET[ 'username' ];\n\n\t// Get password\n\t$pass = $_GET[ 'password' ];\n\t$pass = md5( $pass );\n\n\t// Check the database"</li><li>"Analyze this vulnerable_pattern: if( isset( $_GET[ 'Login' ] ) ) {\n\t// Check Anti-CSRF token\n\tcheckToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );\n\n\t// Sanitise username input\n\t$user = $_GET[ 'username' ];"</li></ul> |
75
- | REAL_SECRET | <ul><li>'Analyze this hardcoded_secret: OPENAI_API_KEY=sk-proj-Tz9mK2nP7qR4sT6uW8vE5fG'</li><li>'Analyze this hardcoded_secret: $this->data = array (\n\t\t\t1 => new User (1, "tony", 0, \'1c8bfe8f801d79745c4631d09fff36c82aa37fc4cce4fc946683d7b336b63032\'),\n\t\t\t2 => new User (2, "morph", 1, \'e5326ba4359f77c2623244acb04f6ac35c4dfca330ebcccdf9b734e5b1df90a8\'),\n\t\t\t3 => new User (3, "chas", 1, \'a89237fc1f9dd8d424d8b8b98b890dbc4a817bfde59af17c39debcc4a14c21de\'),\n\t\t);\n\t\t$this->requestMethod = $requestMethod;\n\t\t$this->userId = $userId;'</li><li>"openai_key: ['Use sk-abcdefghijklmnopqrstuvwxyz0123456789 for calls', 'sk-abcdefghijklmnopqrstuvwxyz0123456789'],\n github_token: ['Push with ghp_abcdefghijklmnopqrstuvwxyz0123456789', 'ghp_abcdefghijklmnopqrstuvwxyz0123456789'],"</li></ul> |
76
- | TEST_MOCK | <ul><li>'Analyze this test_fixture: expected2 = "y=b\'\\\\xe2\\\\xe1\', x=b\'\\\\xe1\\\\xe2\'"\n self.assertIn(txt, (expected1, expected2))\n\n def test_text_kwargs(self):\n txt = str(utils.log_pprint(kwargs={\'x\': \'ŧêßŧ\', \'y\': \'ŧßêŧ\'}))\n expected1 = "x=\'ŧêßŧ\', y=\'ŧßêŧ\'"\n expected2 = "y=\'ŧßêŧ\', x=\'ŧêßŧ\'"'</li><li>'const ACCESS_TOKEN = "AKIAIOSFODNN7EXAMPLE"'</li><li>"Analyze this test_fixture: os.pardir, # /path/to/fboy\n)\n\nMEDIA_ROOT = os.path.join(FACTORY_ROOT, 'tmp_test')\n\nDATABASES = {\n 'default': {"</li></ul> |
77
-
78
- ## Evaluation
79
-
80
- ### Metrics
81
- | Label | Accuracy |
82
- |:--------|:---------|
83
- | **all** | 0.9761 |
84
-
85
  ## Uses
86
 
87
  ### Direct Use for Inference
@@ -100,7 +57,7 @@ from setfit import SetFitModel
100
  # Download from the 🤗 Hub
101
  model = SetFitModel.from_pretrained("setfit_model_id")
102
  # Run inference
103
- preds = model("Analyze this hardcoded_secret: const db = new Pool({ password: 'Pr0duct10n#2024' });")
104
  ```
105
 
106
  <!--
@@ -129,53 +86,6 @@ preds = model("Analyze this hardcoded_secret: const db = new Pool({ password: 'P
129
 
130
  ## Training Details
131
 
132
- ### Training Set Metrics
133
- | Training set | Min | Median | Max |
134
- |:-------------|:----|:--------|:----|
135
- | Word count | 1 | 22.5870 | 224 |
136
-
137
- | Label | Training Sample Count |
138
- |:-----------------|:----------------------|
139
- | REAL_SECRET | 113 |
140
- | VULNERABLE_LOGIC | 240 |
141
- | TEST_MOCK | 240 |
142
- | SAFE_CODE | 240 |
143
-
144
- ### Training Hyperparameters
145
- - batch_size: (16, 16)
146
- - num_epochs: (1, 1)
147
- - max_steps: -1
148
- - sampling_strategy: oversampling
149
- - num_iterations: 5
150
- - body_learning_rate: (2e-05, 1e-05)
151
- - head_learning_rate: 0.01
152
- - loss: CosineSimilarityLoss
153
- - distance_metric: cosine_distance
154
- - margin: 0.25
155
- - end_to_end: False
156
- - use_amp: False
157
- - warmup_proportion: 0.1
158
- - l2_weight: 0.01
159
- - seed: 42
160
- - eval_max_steps: -1
161
- - load_best_model_at_end: True
162
-
163
- ### Training Results
164
- | Epoch | Step | Training Loss | Validation Loss |
165
- |:------:|:----:|:-------------:|:---------------:|
166
- | 0.0019 | 1 | 0.0334 | - |
167
- | 0.0960 | 50 | 0.0839 | - |
168
- | 0.1919 | 100 | 0.0608 | - |
169
- | 0.2879 | 150 | 0.0444 | - |
170
- | 0.3839 | 200 | 0.0285 | - |
171
- | 0.4798 | 250 | 0.0267 | - |
172
- | 0.5758 | 300 | 0.0143 | - |
173
- | 0.6718 | 350 | 0.0141 | - |
174
- | 0.7678 | 400 | 0.0116 | - |
175
- | 0.8637 | 450 | 0.0099 | - |
176
- | 0.9597 | 500 | 0.0092 | - |
177
- | 1.0 | 521 | - | 0.0186 |
178
-
179
  ### Framework Versions
180
  - Python: 3.12.12
181
  - SetFit: 1.1.3
 
4
  - sentence-transformers
5
  - text-classification
6
  - generated_from_setfit_trainer
7
+ widget: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  metrics:
9
  - accuracy
10
  pipeline_tag: text-classification
11
  library_name: setfit
12
  inference: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ---
14
 
15
  # SetFit
 
39
  - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
40
  - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ## Uses
43
 
44
  ### Direct Use for Inference
 
57
  # Download from the 🤗 Hub
58
  model = SetFitModel.from_pretrained("setfit_model_id")
59
  # Run inference
60
+ preds = model("I loved the spiderman movie!")
61
  ```
62
 
63
  <!--
 
86
 
87
  ## Training Details
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ### Framework Versions
90
  - Python: 3.12.12
91
  - SetFit: 1.1.3
config_setfit.json CHANGED
@@ -1,9 +1,9 @@
1
  {
2
- "normalize_embeddings": false,
3
  "labels": [
4
  "REAL_SECRET",
5
  "VULNERABLE_LOGIC",
6
  "TEST_MOCK",
7
  "SAFE_CODE"
8
- ]
 
9
  }
 
1
  {
 
2
  "labels": [
3
  "REAL_SECRET",
4
  "VULNERABLE_LOGIC",
5
  "TEST_MOCK",
6
  "SAFE_CODE"
7
+ ],
8
+ "normalize_embeddings": false
9
  }