Instructions to use fhamborg/newsframes-econ-bin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use fhamborg/newsframes-econ-bin with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("fhamborg/newsframes-econ-bin") 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] - setfit
How to use fhamborg/newsframes-econ-bin with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("fhamborg/newsframes-econ-bin") preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"]) print(preds) - Notebooks
- Google Colab
- Kaggle
Push model using huggingface_hub.
Browse filesFiles changed (12)
- 1_Pooling/config.jsonAdded+7
- README.mdAdded+49
- config.jsonAdded+24
- config_sentence_transformers.jsonAdded+7
- model_head.pklAdded+3
- modules.jsonAdded+14
- pytorch_model.binAdded+3
- sentence_bert_config.jsonAdded+4
- special_tokens_map.jsonAdded+15
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+73
- 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}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849---license: apache-2.0tags:- setfit- sentence-transformers- text-classificationpipeline_tag: text-classification---
# /var/folders/qg/vmj6zq4s7hb2pbkp3b8kstvh0000gn/T/tmpdk_aocux/fhamborg/newsframes-econ-bin
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:
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.
## Usage
To use this model for inference, first install the SetFit library:
```bashpython -m pip install setfit```
You can then run inference as follows:
```pythonfrom setfit import SetFitModel
# Download from Hub and run inferencemodel = SetFitModel.from_pretrained("/var/folders/qg/vmj6zq4s7hb2pbkp3b8kstvh0000gn/T/tmpdk_aocux/fhamborg/newsframes-econ-bin")# Run inferencepreds = model(["i loved the spiderman movie!", "pineapple on pizza is the worst 🤮"])```
## BibTeX entry and citation info
```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}}```123456789101112131415161718192021222324{ "_name_or_path": "models/sentence-transformers-all-mpnet-base-v2-dataset_systematic-random_compare_with-absent_radius-1.json-ECON_2-False-0.15-5e-06-20-3-0.8778467908902692-None-True/", "architectures": [ "MPNetModel" ], "attention_probs_dropout_prob": 0.1, "bos_token_id": 0, "eos_token_id": 2, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "initializer_range": 0.02, "intermediate_size": 3072, "layer_norm_eps": 1e-05, "max_position_embeddings": 514, "model_type": "mpnet", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 1, "relative_attention_num_buckets": 32, "torch_dtype": "float32", "transformers_version": "4.32.1", "vocab_size": 30527}1234567{ "__version__": { "sentence_transformers": "2.0.0", "transformers": "4.7.0", "pytorch": "1.9.0+cu102" }}123version https://git-lfs.github.com/spec/v1oid sha256:0735783eb23a910c9f8e7b0add89b76bcff5814c13d5198fbd1a70a006171231size 70071234567891011121314[ { "idx": 0, "name": "0", "path": "", "type": "sentence_transformers.models.Transformer" }, { "idx": 1, "name": "1", "path": "1_Pooling", "type": "sentence_transformers.models.Pooling" }]123version https://git-lfs.github.com/spec/v1oid sha256:74d385f8c2d704099c36e2c89f9a2f9e3b5d8d8eae5ccf6111bfc1d9e74624f7size 4380092571234{ "max_seq_length": 512, "do_lower_case": false}123456789101112131415{ "bos_token": "<s>", "cls_token": "<s>", "eos_token": "</s>", "mask_token": { "content": "<mask>", "lstrip": true, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": "<pad>", "sep_token": "</s>", "unk_token": "[UNK]"}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273{ "bos_token": { "__type": "AddedToken", "content": "<s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "clean_up_tokenization_spaces": true, "cls_token": { "__type": "AddedToken", "content": "<s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "do_basic_tokenize": true, "do_lower_case": true, "eos_token": { "__type": "AddedToken", "content": "</s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "mask_token": { "__type": "AddedToken", "content": "<mask>", "lstrip": true, "normalized": true, "rstrip": false, "single_word": false }, "max_length": 512, "model_max_length": 512, "never_split": null, "pad_to_multiple_of": null, "pad_token": { "__type": "AddedToken", "content": "<pad>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "pad_token_type_id": 0, "padding_side": "right", "sep_token": { "__type": "AddedToken", "content": "</s>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "stride": 0, "strip_accents": null, "tokenize_chinese_chars": true, "tokenizer_class": "MPNetTokenizer", "truncation_side": "right", "truncation_strategy": "longest_first", "unk_token": { "__type": "AddedToken", "content": "[UNK]", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }}1_Pooling/config.jsonAdded+7
README.mdAdded+49
config.jsonAdded+24
config_sentence_transformers.jsonAdded+7
model_head.pklAdded+3
modules.jsonAdded+14
pytorch_model.binAdded+3
sentence_bert_config.jsonAdded+4
special_tokens_map.jsonAdded+15
tokenizer.jsonAdded
tokenizer_config.jsonAdded+73
vocab.txtAdded