Text Classification
setfit
Safetensors
sentence-transformers
bert
generated_from_setfit_trainer
text-embeddings-inference
Instructions to use Tempo14/parameter-mini-lds_cpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use Tempo14/parameter-mini-lds_cpu with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("Tempo14/parameter-mini-lds_cpu") preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"]) print(preds) - sentence-transformers
How to use Tempo14/parameter-mini-lds_cpu with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Tempo14/parameter-mini-lds_cpu") 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
Push model using huggingface_hub.
Browse filesFiles changed (13)
- 1_Pooling/config.jsonAdded+9
- README.mdAdded+131
- config.jsonAdded+26
- config_sentence_transformers.jsonAdded+7
- config_setfit.jsonAdded+4
- model.safetensorsAdded+3
- model_head.pklAdded+3
- modules.jsonAdded+20
- sentence_bert_config.jsonAdded+4
- special_tokens_map.jsonAdded+37
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+64
- vocab.txtAdded
123456789{ "word_embedding_dimension": 384, "pooling_mode_cls_token": false, "pooling_mode_mean_tokens": true, "pooling_mode_max_tokens": false, "pooling_mode_mean_sqrt_len_tokens": false, "pooling_mode_weightedmean_tokens": false, "pooling_mode_lasttoken": false}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131---library_name: setfittags:- setfit- sentence-transformers- text-classification- generated_from_setfit_trainermetrics:- accuracywidget: []pipeline_tag: text-classificationinference: truebase_model: sentence-transformers/all-MiniLM-L6-v2---
# SetFit with sentence-transformers/all-MiniLM-L6-v2
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) 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:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance- **Maximum Sequence Length:** 256 tokens<!-- - **Number of Classes:** Unknown --><!-- - **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)
## 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("Tempo14/parameter-mini-lds_cpu")# Run inferencepreds = model("I loved the spiderman movie!")```
<!--### 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
### Framework Versions- Python: 3.10.12- SetFit: 1.0.3- Sentence Transformers: 2.3.1- Transformers: 4.37.2- PyTorch: 2.1.0+cu121- Datasets: 2.17.1- Tokenizers: 0.15.2
## 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.*-->1234567891011121314151617181920212223242526{ "_name_or_path": "nategro/parameter-mini-lds", "architectures": [ "BertModel" ], "attention_probs_dropout_prob": 0.1, "classifier_dropout": null, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 384, "initializer_range": 0.02, "intermediate_size": 1536, "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "bert", "num_attention_heads": 12, "num_hidden_layers": 6, "pad_token_id": 0, "position_embedding_type": "absolute", "torch_dtype": "float32", "transformers_version": "4.37.2", "type_vocab_size": 2, "use_cache": true, "vocab_size": 30522}1234567{ "__version__": { "sentence_transformers": "2.0.0", "transformers": "4.6.1", "pytorch": "1.8.1" }}1234{ "labels": null, "normalize_embeddings": false}123version https://git-lfs.github.com/spec/v1oid sha256:9c27b7297fda35acac5dee12e159ccd340cd7c915d1b0f2d36a7cb29f80bcb9dsize 90864192123version https://git-lfs.github.com/spec/v1oid sha256:ceea35606378f0c0e81dd81266bdf2d79f57362fd84e2208c7ded8462b9e1d9fsize 39351234567891011121314151617181920[ { "idx": 0, "name": "0", "path": "", "type": "sentence_transformers.models.Transformer" }, { "idx": 1, "name": "1", "path": "1_Pooling", "type": "sentence_transformers.models.Pooling" }, { "idx": 2, "name": "2", "path": "2_Normalize", "type": "sentence_transformers.models.Normalize" }]1234{ "max_seq_length": 256, "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 }, "100": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "101": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "102": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "103": { "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": 256, "model_max_length": 512, "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+9
README.mdAdded+131
config.jsonAdded+26
config_sentence_transformers.jsonAdded+7
config_setfit.jsonAdded+4
model.safetensorsAdded+3
model_head.pklAdded+3
modules.jsonAdded+20
sentence_bert_config.jsonAdded+4
special_tokens_map.jsonAdded+37
tokenizer.jsonAdded
tokenizer_config.jsonAdded+64
vocab.txtAdded