johnpaulbin commited on
Commit
6fd60f6
·
1 Parent(s): c04ebb0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -37
README.md CHANGED
@@ -1,49 +1,27 @@
1
- ---
2
- license: apache-2.0
3
- tags:
4
- - setfit
5
- - sentence-transformers
6
- - text-classification
7
- pipeline_tag: text-classification
8
- ---
9
-
10
  # johnpaulbin/toxic-MiniLM-L6-H384-uncased
 
11
 
12
- This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. The model has been trained using an efficient few-shot learning technique that involves:
13
-
14
- 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
15
- 2. Training a classification head with features from the fine-tuned Sentence Transformer.
16
 
17
  ## Usage
18
 
19
- To use this model for inference, first install the SetFit library:
20
-
21
- ```bash
22
- python -m pip install setfit
23
- ```
24
 
25
- You can then run inference as follows:
 
26
 
27
  ```python
28
  from setfit import SetFitModel
29
 
30
- # Download from Hub and run inference
31
- model = SetFitModel.from_pretrained("johnpaulbin/toxic-MiniLM-L6-H384-uncased")
32
- # Run inference
33
- preds = model(["i loved the spiderman movie!", "pineapple on pizza is the worst 🤮"])
34
- ```
 
 
 
 
 
35
 
36
- ## BibTeX entry and citation info
37
-
38
- ```bibtex
39
- @article{https://doi.org/10.48550/arxiv.2209.11055,
40
- doi = {10.48550/ARXIV.2209.11055},
41
- url = {https://arxiv.org/abs/2209.11055},
42
- author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
43
- keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
44
- title = {Efficient Few-Shot Learning Without Prompts},
45
- publisher = {arXiv},
46
- year = {2022},
47
- copyright = {Creative Commons Attribution 4.0 International}
48
- }
49
  ```
 
 
 
 
 
 
 
 
 
 
1
  # johnpaulbin/toxic-MiniLM-L6-H384-uncased
2
+ Test if a sentence is toxic. Only works for english sentences.
3
 
 
 
 
 
4
 
5
  ## Usage
6
 
7
+ Basic classification. Labels: [NOT TOXIC, TOXIC]
 
 
 
 
8
 
9
+ Install setfit
10
+ `!pip install setfit`
11
 
12
  ```python
13
  from setfit import SetFitModel
14
 
15
+ model = SetFitModel.from_pretrained("johnpaulbin/beanbox-toxic")
16
+
17
+ inpt = "" #@param {type:"string"}
18
+
19
+ out = model.predict_proba([inpt])
20
+
21
+ if out[0][0] > out[0][1]:
22
+ print("Not toxic")
23
+ else:
24
+ print("Toxic!")
25
 
26
+ print(f"NOT TOXIC: {out[0][0]}\nTOXIC: {out[0][1]}")
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```