setfit safetensors mpnet sentence-transformers text-classification generated_from_setfit_trainer arxiv:2209.11055 base_model:sentence-transformers/paraphrase-mpnet-base-v2 base_model:finetune:sentence-transformers/paraphrase-mpnet-base-v2 model-index region:us
---
base_model: sentence-transformers/paraphrase-mpnet-base-v2
library_name: setfit
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: "Japan told the General Agreement on\nTariffs and Trade that South Korea's\
    \ five-year import\ndiversification plan violated the spirit of the world trade\n\
    governing body, a Foreign Ministry spokesman said.\n    The notification came\
    \ in Japan's answer to a recent GATT\nquestionnaire on unfair trade practices,\
    \ the spokesman said.\n    In the five-year plan, which starts this year, South\
    \ Korea\naims to reduce its dependency on Japan as a source of imported\ngoods\
    \ and to increase imports from the U.S. And Europe.\n    Japan's move came after\
    \ several unsuccessful bilateral\nnegotiations on the plan, the spokesman said.\
    \ \"The notification\ndoes not represent anything resembling a formal complaint,\
    \ nor\nis it intended to pressure South Korea. It is a routine\nprocedure followed\
    \ by all other GATT member states.\"\n Reuter\n"
- text: "Japan cannot bear a further rise of the\nyen, Foreign Minister Tadashi Kuranari\
    \ said.\n    \"A further stronger yen would be a misfortune for Japan and\nthe\
    \ Japanese people would not be able to bear such a burden,\" he\ntold reporters.\n\
    \    The minister said he wants to tell U.S. Political leaders\nof the sacrifices\
    \ Japan is making to cut its trade surplus.\n    Kuranari was widely expected\
    \ to fly to Washington tomorrow\nfor talks focussing on trade. But departure remains\
    \ uncertain\nbecause of the continuing parliamentary boycott by opposition\nparties\
    \ protesting plans for a new sales tax.\n    If the boycott is lifted tomorrow,\
    \ Kuranari would probably\nhave to remain in Japan to attend parliamentary discussions\
    \ on\nthe government's 1987/88 budget, Japanese officials said.\n    Kuranari\
    \ said both the U.S. And Japan should approach the\ntrade imbalance in a calm,\
    \ unemotional manner.\n    But, he added, \"If the issue of rice is to be raised...I\n\
    would mention the feelings of the Japanese people.\"\n    Japanese politicians\
    \ have said repeatedly the country\ncannot bow to U.S. Pressure to liberalize\
    \ rice imports because\nthe issue is too sensitive.\n REUTER\n"
- text: "The European Community Commission\nconfirmed it granted export licences for\
    \ 59,000 tonnes of\ncurrent series white sugar at a maximum export rebate of 45.678\n\
    European Currency Units (ECUs) per 100 kilos.\n    Out of this, traders in West\
    \ Germany received 34,750\ntonnes, in the U.K. 13,000, in Denmark 7,250 tonnes\
    \ and in\nFrance 4,000 tonnes.\n REUTER\n"
- text: "Chancellor of the Exchequer Nigel\nLawson's Budget speech was described as\
    \ sound and well balanced\nby analysts, if slightly lacking in excitement.\n \
    \   A cut in bank base lending rates is now widely expected\ntomorrow, with most\
    \ forecasts predicting a half-point fall. A\nfollow-up half-point cut is anticipated\
    \ next week.\n    \"Worthy but boring would probably sum it up,\" Peter Fellner,\n\
    U.K. Economist at stockbrokers James Capel and Co, said. \"It was\na very, very\
    \ prudent fiscal budget.\"\n    Richard Jeffrey of brokers Hoare Govett said it\
    \ was a\nwell-balanced budget within the confines of the government's\nphilosophy\
    \ of keeping expenditure levels flat.\n    Most analysts said the Budget was very\
    \ sound on the fiscal\nside, but offered nothing new on monetary policy.\n   \
    \ As was widely expected, Lawson split his \"fiscal adjustment\"\nbetween trimming\
    \ the 1987/88 PSBR target to 4.0 billion stg\nfrom 7.1 billion and cutting basic\
    \ rate income tax from 29 to\n27 pct.\n    The target for the narrow measure of\
    \ money supply, M0, was\nkept unchangd at two to six pct, while the target for\
    \ the broad\nSterling M3 aggregate was dropped.\n    Both Jeffrey and Fellner\
    \ said the budget clears the way for\na half-point fall in U.K. Base rates tomorrow,\
    \ but the\nauthorities are unlikely to sanction a larger cut immediately.\nMany\
    \ analysts and currency dealers have forecast a full\none-point cut tomorrow.\n\
    \    \"The Bank of England will be loathe to take any action which\nit will have\
    \ to reverse later,\" Jeffrey said, though he added a\nfurther half-point cut\
    \ was quite possible in the near future.\n    The main worry from today's speech\
    \ is the outlook for\ninflation, given the signs of relaxed monetary policy contained\n\
    in it, Scrimgeour Vickers economist Richard Holt said.\n    Holt noted the \"\
    rather loose\" inflation forecast of 4.0 pct\nat end-1987, and said the lower\
    \ interest rates likely to result\nfrom the tough fiscal stance could cause longer\
    \ term concern.\n    \"A higher PSBR target could be preferable in the long term,\"\
    \nhe said, although lower mortgage interest rates on the back of\nfalling base\
    \ rates would have an offsetting impact on\ninflation.\n    The Budget will inspire\
    \ a lot of short-term confidence but\nit was \"not a good budget for inflation,\"\
    \ he said\n    Jeffrey said he would have liked Lawson to say more about\nthe\
    \ dangers of excessive liquidity build-up but overall was not\ntoo concerned about\
    \ a revival of inflation.\n    Fellner noted that the exchange rate was to remain\
    \ the\n\"leading edge\" of monetary policy, but said the authorities were\nlikely\
    \ to be extremely cautious on this front.\n    He said they were unlikely to hesitate\
    \ in holding interest\nrates steady or even raising them again if sterling showed\
    \ any\nsigns of excessive weakness.\n    Most analysts agreed Lawson had bolstered\
    \ the credibility\nof the Budget by adopting realistic forecasts.\n    Raising\
    \ the forecast for the current account deficit from\n1.5 to 2.5 billion stg for\
    \ 1987 would not unsettle the markets,\nwhich are already discounting that amount,\
    \ Jeffrey said.\nthat the 4.0 billion stg PSBR target was given credibility by\n\
    the favourable outturn for 1986/87, which is now also forecast\nto be 4.0 billion\
    \ stg.\n    But analysts said the Budget speech did not give any\nclear-cut indication\
    \ about the timing of the general election,\nwhich has to be held before June,\
    \ 1988.\n    Some believe it signals a poll this June, noting that the\nbenefits,\
    \ such as income tax cuts and the decision not to raise\nduties on alcohol and\
    \ tobacco, become available immediately.\n    But others said it kept several\
    \ options open and it was not\npossible to deduce too much from it.\n    James\
    \ Capel's Fellner noted that by being fiscally prudent,\nLawson had kept open\
    \ the possibility of an autumn election in\nthat there would be no \"chickens\
    \ coming home to roost.\"\n    Richard Jeffrey, who favours the likelihood of\
    \ a June\nelection, said it was important the Chancellor had not gone for\na Budget\
    \ aimed overtly at buying an election victory.\n    Nevertheless, he said, it\
    \ was likely to result in a boost\nto the Conservative Party's pre-election popularity.\n\
    \ REUTER\n"
- text: "Booker Plc &lt;BOKL.L> said 1987 had\nstarted well and the group had the\
    \ resources to invest in its\ngrowth business both organically and by acquisition.\n\
    \    It was commenting on figures for 1986 which showed pretax\nprofits rising\
    \ to 54.6 mln from 46.5 mln previously. Profits\nfrom the U.S. Accounted for 39\
    \ pct of the total. The results\nwere broadly in line with analysts' forecasts\
    \ and the company's\nshares firmed in morning trading to 421p from 413p at Friday's\n\
    close.\n    The group ended the year with a cash surplus higher at 54\nmln stg,\
    \ compared to 26 mln previously, after capital\nexpenditure which rose to 54 mln\
    \ from 43 mln.\n    In a statement, the company said the U.K. Agribusiness\ngroup\
    \ reported excellent profits growth while health products\nprofits rose to 6.5\
    \ mln from 5.4 mln.\n REUTER\n"
inference: false
model-index:
- name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: Unknown
      type: unknown
      split: test
    metrics:
    - type: accuracy
      value: 0.916083916083916
      name: Accuracy
---

# SetFit with sentence-transformers/paraphrase-mpnet-base-v2

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2) as the Sentence Transformer embedding model. A OneVsRestClassifier 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/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
- **Classification head:** a OneVsRestClassifier instance
- **Maximum Sequence Length:** 512 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)

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.9161   |

## Uses

### Direct Use for Inference

First install the SetFit library:

```bash
pip install setfit
```

Then you can load this model and run inference.

```python
from setfit import SetFitModel

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("ardi555/setfit_mpnet_reuters21578_reducedto15")
# Run inference
preds = model("The European Community Commission
confirmed it granted export licences for 59,000 tonnes of
current series white sugar at a maximum export rebate of 45.678
European Currency Units (ECUs) per 100 kilos.
    Out of this, traders in West Germany received 34,750
tonnes, in the U.K. 13,000, in Denmark 7,250 tonnes and in
France 4,000 tonnes.
 REUTER
")
```

<!--
### 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   | 20  | 204.4467 | 1075 |

### Training Hyperparameters
- batch_size: (8, 8)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- body_learning_rate: (2e-05, 2e-05)
- 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
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0013 | 1    | 0.2676        | -               |
| 0.0667 | 50   | 0.1617        | -               |
| 0.1333 | 100  | 0.0869        | -               |
| 0.2    | 150  | 0.0583        | -               |
| 0.2667 | 200  | 0.0766        | -               |
| 0.3333 | 250  | 0.0578        | -               |
| 0.4    | 300  | 0.0483        | -               |
| 0.4667 | 350  | 0.0374        | -               |
| 0.5333 | 400  | 0.0372        | -               |
| 0.6    | 450  | 0.039         | -               |
| 0.6667 | 500  | 0.0367        | -               |
| 0.7333 | 550  | 0.0378        | -               |
| 0.8    | 600  | 0.0299        | -               |
| 0.8667 | 650  | 0.0317        | -               |
| 0.9333 | 700  | 0.0308        | -               |
| 1.0    | 750  | 0.0293        | -               |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.1.0
- Sentence Transformers: 3.2.1
- Transformers: 4.42.2
- PyTorch: 2.5.1+cu121
- Datasets: 3.1.0
- Tokenizers: 0.19.1

## 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.*
-->