Sumeetgpt commited on
Commit
30c4802
·
verified ·
1 Parent(s): 11da122

Push model using huggingface_hub.

Browse files
Files changed (4) hide show
  1. README.md +2 -94
  2. config_setfit.json +2 -2
  3. model.safetensors +1 -1
  4. model_head.pkl +1 -1
README.md CHANGED
@@ -4,42 +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: "Analyze this vulnerable_pattern: var name_input = document.getElementById\
15
- \ ('name');\n\n\t\t\tif (user_json.name == '') {\n\t\t\t\tuser_info.innerHTML\
16
- \ = 'User details: unknown user';\n\t\t\t\tname_input.value = 'unknown';\n\t\t\
17
- \t} else {\n\t\t\t\tvar level = 'unknown';"
18
- - text: 'Analyze this hardcoded_secret: const db = new Pool({ password: ''Pr0duct10n#2024''
19
- });'
20
- - text: "Analyze this hardcoded_secret: name: \"Blake2b with 'Hello, World!'\"\
21
- ,\n\t\t\thasher: NewBlake2B(),\n\t\t\tinput: []byte(\"Hello, World!\"\
22
- ),\n\t\t\texpectedHex: \"511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03\"\
23
- ,\n\t\t},\n\t\t{\n\t\t\tname: \"Blake2b input at max size\","
24
  metrics:
25
  - accuracy
26
  pipeline_tag: text-classification
27
  library_name: setfit
28
  inference: true
29
- model-index:
30
- - name: SetFit
31
- results:
32
- - task:
33
- type: text-classification
34
- name: Text Classification
35
- dataset:
36
- name: Unknown
37
- type: unknown
38
- split: test
39
- metrics:
40
- - type: accuracy
41
- value: 0.9808612440191388
42
- name: Accuracy
43
  ---
44
 
45
  # SetFit
@@ -69,21 +39,6 @@ The model has been trained using an efficient few-shot learning technique that i
69
  - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
70
  - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
71
 
72
- ### Model Labels
73
- | Label | Examples |
74
- |:-----------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75
- | 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> |
76
- | VULNERABLE_LOGIC | <ul><li>'try {\n res = await exec(`${ezu} apikey-update --apikey user --attributes doi,is_oa`);'</li><li>'cls()\n os.system("git clone https://github.com/mrwn007/M3M0")'</li><li>'count = cursor.fetchone()[0]\n\tcursor.execute("SELECT text FROM posts OFFSET random()*" + str(count) + " LIMIT 1;")'</li></ul> |
77
- | 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> |
78
- | 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> |
79
-
80
- ## Evaluation
81
-
82
- ### Metrics
83
- | Label | Accuracy |
84
- |:--------|:---------|
85
- | **all** | 0.9809 |
86
-
87
  ## Uses
88
 
89
  ### Direct Use for Inference
@@ -102,7 +57,7 @@ from setfit import SetFitModel
102
  # Download from the 🤗 Hub
103
  model = SetFitModel.from_pretrained("setfit_model_id")
104
  # Run inference
105
- preds = model("Analyze this hardcoded_secret: const db = new Pool({ password: 'Pr0duct10n#2024' });")
106
  ```
107
 
108
  <!--
@@ -131,53 +86,6 @@ preds = model("Analyze this hardcoded_secret: const db = new Pool({ password: 'P
131
 
132
  ## Training Details
133
 
134
- ### Training Set Metrics
135
- | Training set | Min | Median | Max |
136
- |:-------------|:----|:--------|:----|
137
- | Word count | 1 | 22.5510 | 224 |
138
-
139
- | Label | Training Sample Count |
140
- |:-----------------|:----------------------|
141
- | REAL_SECRET | 113 |
142
- | VULNERABLE_LOGIC | 240 |
143
- | TEST_MOCK | 240 |
144
- | SAFE_CODE | 240 |
145
-
146
- ### Training Hyperparameters
147
- - batch_size: (16, 16)
148
- - num_epochs: (1, 1)
149
- - max_steps: -1
150
- - sampling_strategy: oversampling
151
- - num_iterations: 5
152
- - body_learning_rate: (2e-05, 1e-05)
153
- - head_learning_rate: 0.01
154
- - loss: CosineSimilarityLoss
155
- - distance_metric: cosine_distance
156
- - margin: 0.25
157
- - end_to_end: False
158
- - use_amp: False
159
- - warmup_proportion: 0.1
160
- - l2_weight: 0.01
161
- - seed: 42
162
- - eval_max_steps: -1
163
- - load_best_model_at_end: True
164
-
165
- ### Training Results
166
- | Epoch | Step | Training Loss | Validation Loss |
167
- |:------:|:----:|:-------------:|:---------------:|
168
- | 0.0019 | 1 | 0.0013 | - |
169
- | 0.0960 | 50 | 0.0125 | - |
170
- | 0.1919 | 100 | 0.0052 | - |
171
- | 0.2879 | 150 | 0.0097 | - |
172
- | 0.3839 | 200 | 0.0039 | - |
173
- | 0.4798 | 250 | 0.0032 | - |
174
- | 0.5758 | 300 | 0.0015 | - |
175
- | 0.6718 | 350 | 0.0016 | - |
176
- | 0.7678 | 400 | 0.0011 | - |
177
- | 0.8637 | 450 | 0.0013 | - |
178
- | 0.9597 | 500 | 0.0022 | - |
179
- | 1.0 | 521 | - | 0.0106 |
180
-
181
  ### Framework Versions
182
  - Python: 3.12.12
183
  - 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
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d429423c6c6443c185e9b247e0baffd8c275b7203b7805fa8b752a627ba39327
3
  size 90864192
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f79890db002810c3b5b4a3f7cc67c5997c2e74a64ece5ff9f910fc3e3159b50
3
  size 90864192
model_head.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:912b00c8359808d2fe28ed9dd33f89b3cd6566839568ffa4510044c632dc92cb
3
  size 13191
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53aa7ed6dafc0432c496821cdd6a8f92914f8a3e68b0c56af094e178c5c70f7b
3
  size 13191