Text Classification
setfit
Safetensors
sentence-transformers
bert
generated_from_setfit_trainer
Eval Results (legacy)
text-embeddings-inference
Run this model with HF Jobs
Run firqaaa/indo-setfit-bert-base-p2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/firqaaa/indo-setfit-bert-base-p2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/firqaaa/indo-setfit-bert-base-p2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use firqaaa/indo-setfit-bert-base-p2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use firqaaa/indo-setfit-bert-base-p2 with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("firqaaa/indo-setfit-bert-base-p2") preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"]) print(preds) - sentence-transformers
How to use firqaaa/indo-setfit-bert-base-p2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("firqaaa/indo-setfit-bert-base-p2") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Add SetFit model
Browse filesFiles changed (13)
- 1_Pooling/config.jsonAdded+7
- README.mdAdded+331
- config.jsonAdded+47
- config_sentence_transformers.jsonAdded+7
- config_setfit.jsonAdded+10
- model.safetensorsAdded+3
- model_head.pklAdded+3
- modules.jsonAdded+14
- sentence_bert_config.jsonAdded+4
- special_tokens_map.jsonAdded+37
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+64
- vocab.txtAdded
1234567{ "word_embedding_dimension": 768, "pooling_mode_cls_token": false, "pooling_mode_mean_tokens": true, "pooling_mode_max_tokens": false, "pooling_mode_mean_sqrt_len_tokens": false}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331---library_name: setfittags:- setfit- sentence-transformers- text-classification- generated_from_setfit_trainermetrics:- accuracywidget:- text: aku hanya menyukai setiap menit film ini.- text: bioskop orang dalam kondisi terbaiknya.- text: bukan untuk orang yang mudah tersinggung atau mudah tersinggung, ini adalah pemeriksaan yang berani dan berkepanjangan terhadap budaya yang diidolakan, kebencian terhadap diri sendiri, dan politik seksual.- text: itu curang.- text: Meskipun penduduk setempat akan senang melihat situs-situs Cleveland, seluruh dunia akan menikmati komedi bertempo cepat dengan keunikan yang mungkin membuat iri para coen bersaudara yang telah memenangkan penghargaan.pipeline_tag: text-classificationinference: truebase_model: firqaaa/indo-sentence-bert-basemodel-index:- name: SetFit with firqaaa/indo-sentence-bert-base results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.3425339366515837 name: Accuracy---
# SetFit with firqaaa/indo-sentence-bert-base
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [firqaaa/indo-sentence-bert-base](https://huggingface.co/firqaaa/indo-sentence-bert-base) as the Sentence Transformer embedding model. A [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.2. Training a classification head with features from the fine-tuned Sentence Transformer.
## Model Details
### Model Description- **Model Type:** SetFit- **Sentence Transformer body:** [firqaaa/indo-sentence-bert-base](https://huggingface.co/firqaaa/indo-sentence-bert-base)- **Classification head:** a [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance- **Maximum Sequence Length:** 512 tokens- **Number of Classes:** 5 classes<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) --><!-- - **Language:** Unknown --><!-- - **License:** Unknown -->
### Model Sources
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
### Model Labels| Label | Examples ||:---------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|| sangat positif | <ul><li>"tema universal untuk menjadi orang yang lebih baik melalui cinta belum pernah difilmkan dengan cara yang lebih menarik daripada di `baran. '"</li><li>'hangat dalam penggambaran manusia sehari-hari yang penuh kasih namun tidak konsisten, santai dalam langkah tenang yang sempurna, dan bangga dalam pesannya.'</li><li>'kecerdasan yang mendalam serta kasih sayang yang hangat dan menyelimuti terhembus dari setiap bingkainya.'</li></ul> || sangat negatif | <ul><li>'sebuah film kejam yang dibuat oleh seseorang yang pasti membaca catcher in the rye tetapi jelas-jelas menderita disleksia'</li><li>"all the queen's men adalah film perang kemunduran yang gagal dalam berbagai tingkatan, sehingga harus membayar ganti rugi kepada pemirsa."</li><li>'... ini bahkan bukan film yang bisa kita nikmati sebagai pelarian ringan; ini adalah ketakutan dan frustrasi yang dipicu hingga tingkat yang tidak dapat ditoleransi.'</li></ul> || positif | <ul><li>'direktur kredit ramsay karena mengambil cerita yang terkadang mustahil dan membuatnya terasa realistis.'</li><li>'patut diberi hormat hanya karena mencoba menjadi lebih kompleks daripada film rata-rata Anda.'</li><li>'tapi secara keseluruhan, Anda akan menyukai film ini.'</li></ul> || negatif | <ul><li>'semua orang harus disalahkan di sini.'</li><li>'tontonan hingar bingar -lrb- di acara TV -rrb- biasanya telah diragi oleh pesona yang secara mencolok hilang dari ledakan layar lebar gadis-gadis itu.'</li><li>'alur cerita, karakter, drama, emosi, ide – semuanya tidak relevan dengan pengalaman melihat raja kalajengking.'</li></ul> || netral | <ul><li>'affleck hanya menciptakan garis besar untuk sebuah peran yang masih perlu ia kembangkan, sebuah peran yang dengan mudah dipenuhi dengan otoritas.'</li><li>'sutradara oliver parker bekerja keras untuk mengubah kehidupan menjadi pentingnya bersikap sungguh-sungguh sehingga dia mungkin menarik satu atau dua otot.'</li><li>'clayburgh dan tambor adalah pemain yang menawan; tak satu pun dari mereka pantas menerima Eric Schaeffer.'</li></ul> |
## Evaluation
### Metrics| Label | Accuracy ||:--------|:---------|| **all** | 0.3425 |
## Uses
### Direct Use for Inference
First install the SetFit library:
```bashpip install setfit```
Then you can load this model and run inference.
```pythonfrom setfit import SetFitModel
# Download from the 🤗 Hubmodel = SetFitModel.from_pretrained("firqaaa/indo-setfit-bert-base-p2")# Run inferencepreds = model("itu curang.")```
<!--### Downstream Use
*List how someone could finetune this model on their own dataset.*-->
<!--### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*-->
<!--## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*-->
<!--### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*-->
## Training Details
### Training Set Metrics| Training set | Min | Median | Max ||:-------------|:----|:-------|:----|| Word count | 2 | 15.476 | 46 |
| Label | Training Sample Count ||:---------------|:----------------------|| sangat negatif | 200 || negatif | 200 || netral | 200 || positif | 200 || sangat positif | 200 |
### Training Hyperparameters- batch_size: (128, 32)- num_epochs: (1, 8)- max_steps: -1- sampling_strategy: oversampling- body_learning_rate: (2e-05, 5e-06)- head_learning_rate: 2e-05- loss: CosineSimilarityLoss- distance_metric: cosine_distance- margin: 0.25- end_to_end: False- use_amp: False- warmup_proportion: 0.1- seed: 42- eval_max_steps: -1- load_best_model_at_end: True
### Training Results| Epoch | Step | Training Loss | Validation Loss ||:-------:|:--------:|:-------------:|:---------------:|| 0.0002 | 1 | 0.3317 | - || 0.008 | 50 | 0.2883 | - || 0.016 | 100 | 0.2625 | - || 0.024 | 150 | 0.2516 | - || 0.032 | 200 | 0.2075 | - || 0.04 | 250 | 0.184 | - || 0.048 | 300 | 0.1632 | - || 0.056 | 350 | 0.1105 | - || 0.064 | 400 | 0.1109 | - || 0.072 | 450 | 0.0934 | - || 0.08 | 500 | 0.0518 | - || 0.088 | 550 | 0.0246 | - || 0.096 | 600 | 0.0133 | - || 0.104 | 650 | 0.0056 | - || 0.112 | 700 | 0.006 | - || 0.12 | 750 | 0.0072 | - || 0.128 | 800 | 0.0179 | - || 0.136 | 850 | 0.0025 | - || 0.144 | 900 | 0.0019 | - || 0.152 | 950 | 0.0008 | - || 0.16 | 1000 | 0.0009 | - || 0.168 | 1050 | 0.0016 | - || 0.176 | 1100 | 0.0008 | - || 0.184 | 1150 | 0.0009 | - || 0.192 | 1200 | 0.0006 | - || 0.2 | 1250 | 0.0112 | - || 0.208 | 1300 | 0.0007 | - || 0.216 | 1350 | 0.0005 | - || 0.224 | 1400 | 0.0006 | - || 0.232 | 1450 | 0.0004 | - || 0.24 | 1500 | 0.0003 | - || 0.248 | 1550 | 0.0111 | - || 0.256 | 1600 | 0.0007 | - || 0.264 | 1650 | 0.0004 | - || 0.272 | 1700 | 0.0068 | - || 0.28 | 1750 | 0.0006 | - || 0.288 | 1800 | 0.008 | - || 0.296 | 1850 | 0.0004 | - || 0.304 | 1900 | 0.0009 | - || 0.312 | 1950 | 0.0004 | - || 0.32 | 2000 | 0.0003 | - || 0.328 | 2050 | 0.0034 | - || 0.336 | 2100 | 0.0003 | - || 0.344 | 2150 | 0.0002 | - || 0.352 | 2200 | 0.0002 | - || 0.36 | 2250 | 0.0002 | - || 0.368 | 2300 | 0.0002 | - || 0.376 | 2350 | 0.0002 | - || 0.384 | 2400 | 0.0002 | - || 0.392 | 2450 | 0.0001 | - || 0.4 | 2500 | 0.0002 | - || 0.408 | 2550 | 0.0001 | - || 0.416 | 2600 | 0.0001 | - || 0.424 | 2650 | 0.0002 | - || 0.432 | 2700 | 0.0001 | - || 0.44 | 2750 | 0.0001 | - || 0.448 | 2800 | 0.0001 | - || 0.456 | 2850 | 0.0003 | - || 0.464 | 2900 | 0.0001 | - || 0.472 | 2950 | 0.0001 | - || 0.48 | 3000 | 0.0004 | - || 0.488 | 3050 | 0.0002 | - || 0.496 | 3100 | 0.0001 | - || 0.504 | 3150 | 0.0003 | - || 0.512 | 3200 | 0.0001 | - || 0.52 | 3250 | 0.0001 | - || 0.528 | 3300 | 0.0002 | - || 0.536 | 3350 | 0.0001 | - || 0.544 | 3400 | 0.0001 | - || 0.552 | 3450 | 0.0001 | - || 0.56 | 3500 | 0.0001 | - || 0.568 | 3550 | 0.0001 | - || 0.576 | 3600 | 0.0001 | - || 0.584 | 3650 | 0.0001 | - || 0.592 | 3700 | 0.0001 | - || 0.6 | 3750 | 0.0 | - || 0.608 | 3800 | 0.0001 | - || 0.616 | 3850 | 0.0001 | - || 0.624 | 3900 | 0.0001 | - || 0.632 | 3950 | 0.0001 | - || 0.64 | 4000 | 0.0003 | - || 0.648 | 4050 | 0.0001 | - || 0.656 | 4100 | 0.0001 | - || 0.664 | 4150 | 0.0001 | - || 0.672 | 4200 | 0.0001 | - || 0.68 | 4250 | 0.0001 | - || 0.688 | 4300 | 0.0001 | - || 0.696 | 4350 | 0.0001 | - || 0.704 | 4400 | 0.0001 | - || 0.712 | 4450 | 0.0001 | - || 0.72 | 4500 | 0.0001 | - || 0.728 | 4550 | 0.0001 | - || 0.736 | 4600 | 0.0001 | - || 0.744 | 4650 | 0.0001 | - || 0.752 | 4700 | 0.0001 | - || 0.76 | 4750 | 0.0001 | - || 0.768 | 4800 | 0.0001 | - || 0.776 | 4850 | 0.0001 | - || 0.784 | 4900 | 0.0001 | - || 0.792 | 4950 | 0.0001 | - || 0.8 | 5000 | 0.0 | - || 0.808 | 5050 | 0.0001 | - || 0.816 | 5100 | 0.0001 | - || 0.824 | 5150 | 0.0001 | - || 0.832 | 5200 | 0.0 | - || 0.84 | 5250 | 0.0001 | - || 0.848 | 5300 | 0.0001 | - || 0.856 | 5350 | 0.0 | - || 0.864 | 5400 | 0.0001 | - || 0.872 | 5450 | 0.0001 | - || 0.88 | 5500 | 0.0001 | - || 0.888 | 5550 | 0.0001 | - || 0.896 | 5600 | 0.0 | - || 0.904 | 5650 | 0.0001 | - || 0.912 | 5700 | 0.0001 | - || 0.92 | 5750 | 0.0001 | - || 0.928 | 5800 | 0.0 | - || 0.936 | 5850 | 0.0 | - || 0.944 | 5900 | 0.0 | - || 0.952 | 5950 | 0.0 | - || 0.96 | 6000 | 0.0 | - || 0.968 | 6050 | 0.0 | - || 0.976 | 6100 | 0.0001 | - || 0.984 | 6150 | 0.0 | - || 0.992 | 6200 | 0.0 | - || **1.0** | **6250** | **0.0** | **0.3546** |
* The bold row denotes the saved checkpoint.### Framework Versions- Python: 3.10.13- SetFit: 1.0.3- Sentence Transformers: 2.2.2- Transformers: 4.36.2- PyTorch: 2.1.2+cu121- Datasets: 2.16.1- Tokenizers: 0.15.0
## Citation
### BibTeX```bibtex@article{https://doi.org/10.48550/arxiv.2209.11055, doi = {10.48550/ARXIV.2209.11055}, url = {https://arxiv.org/abs/2209.11055}, author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren}, keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences}, title = {Efficient Few-Shot Learning Without Prompts}, publisher = {arXiv}, year = {2022}, copyright = {Creative Commons Attribution 4.0 International}}```
<!--## Glossary
*Clearly define terms in order to be accessible across audiences.*-->
<!--## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*-->
<!--## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*-->1234567891011121314151617181920212223242526272829303132333435363738394041424344454647{ "_name_or_path": "checkpoints/step_6250/", "_num_labels": 5, "architectures": [ "BertModel" ], "attention_probs_dropout_prob": 0.1, "classifier_dropout": null, "directionality": "bidi", "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "id2label": { "0": "LABEL_0", "1": "LABEL_1", "2": "LABEL_2", "3": "LABEL_3", "4": "LABEL_4" }, "initializer_range": 0.02, "intermediate_size": 3072, "label2id": { "LABEL_0": 0, "LABEL_1": 1, "LABEL_2": 2, "LABEL_3": 3, "LABEL_4": 4 }, "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "bert", "num_attention_heads": 12, "num_hidden_layers": 12, "output_past": true, "pad_token_id": 0, "pooler_fc_size": 768, "pooler_num_attention_heads": 12, "pooler_num_fc_layers": 3, "pooler_size_per_head": 128, "pooler_type": "first_token_transform", "position_embedding_type": "absolute", "torch_dtype": "float32", "transformers_version": "4.36.2", "type_vocab_size": 2, "use_cache": true, "vocab_size": 50000}1234567{ "__version__": { "sentence_transformers": "2.2.2", "transformers": "4.20.1", "pytorch": "1.11.0" }}12345678910{ "labels": [ "sangat negatif", "negatif", "netral", "positif", "sangat positif" ], "normalize_embeddings": false}123version https://git-lfs.github.com/spec/v1oid sha256:0d2a8f42ec04b816aaf02e1a21e70d2eb0b68871bdceaa58c7c07a9c72d1ead1size 497787752123version https://git-lfs.github.com/spec/v1oid sha256:4c4cc1a3430422fff821dbd9e1f63b23e94091b0d597bc104c7a48fa18920abasize 169121234567891011121314[ { "idx": 0, "name": "0", "path": "", "type": "sentence_transformers.models.Transformer" }, { "idx": 1, "name": "1", "path": "1_Pooling", "type": "sentence_transformers.models.Pooling" }]1234{ "max_seq_length": 512, "do_lower_case": false}12345678910111213141516171819202122232425262728293031323334353637{ "cls_token": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "mask_token": { "content": "[MASK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "[PAD]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "sep_token": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364{ "added_tokens_decoder": { "0": { "content": "[PAD]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "2": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "3": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "4": { "content": "[MASK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "clean_up_tokenization_spaces": true, "cls_token": "[CLS]", "do_basic_tokenize": true, "do_lower_case": true, "mask_token": "[MASK]", "max_length": 512, "model_max_length": 1000000000000000019884624838656, "never_split": null, "pad_to_multiple_of": null, "pad_token": "[PAD]", "pad_token_type_id": 0, "padding_side": "right", "sep_token": "[SEP]", "stride": 0, "strip_accents": null, "tokenize_chinese_chars": true, "tokenizer_class": "BertTokenizer", "truncation_side": "right", "truncation_strategy": "longest_first", "unk_token": "[UNK]"}1_Pooling/config.jsonAdded+7
README.mdAdded+331
config.jsonAdded+47
config_sentence_transformers.jsonAdded+7
config_setfit.jsonAdded+10
model.safetensorsAdded+3
model_head.pklAdded+3
modules.jsonAdded+14
sentence_bert_config.jsonAdded+4
special_tokens_map.jsonAdded+37
tokenizer.jsonAdded
tokenizer_config.jsonAdded+64
vocab.txtAdded