fast-sentence-transformers
Simply, faster, sentence-transformers
https://github.com/davidberenstein1957/fast-sentence-transformers
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.6%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Simply, faster, sentence-transformers
Basic Info
Statistics
- Stars: 143
- Watchers: 4
- Forks: 10
- Open Issues: 5
- Releases: 17
Topics
Metadata Files
README.md
Fast Sentence Transformers
This repository contains code to run faster feature extractors using tools like quantization, optimization and ONNX. Just run your model much faster, while using less of memory. There is not much to it!
Phillip Schmid: "We successfully quantized our vanilla Transformers model with Hugging Face and managed to accelerate our model latency from 25.6ms to 12.3ms or 2.09x while keeping 100% of the accuracy on the stsb dataset. But I have to say that this isn't a plug and play process you can transfer to any Transformers model, task or dataset.""
Install
bash
pip install fast-sentence-transformers
Or, for GPU support:
bash
pip install fast-sentence-transformers[gpu]
Quickstart
```python
from fastsentencetransformers import FastSentenceTransformer as SentenceTransformer
use any sentence-transformer
encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2", device="cpu")
encoder.encode("Hello hello, hey, hello hello") encoder.encode(["Life is too short to eat bad food!"] * 2) ```
Benchmark
Non-exact, indicative benchmark for speed an memory usage with smaller and larger model on sentence-transformers
| model | Type | default | ONNX | ONNX+quantized | ONNX+GPU | | ------------------------------------- | ------ | ------- | ---- | -------------- | -------- | | paraphrase-albert-small-v2 | memory | 1x | 1x | 1x | 1x | | | speed | 1x | 2x | 5x | 20x | | paraphrase-multilingual-mpnet-base-v2 | memory | 1x | 1x | 4x | 4x | | | speed | 1x | 2x | 5x | 20x |
Shout-Out
This package heavily leans on https://www.philschmid.de/optimize-sentence-transformers.
Owner
- Name: David Berenstein
- Login: davidberenstein1957
- Kind: user
- Location: Madrid
- Company: @argilla-io
- Website: https://www.linkedin.com/in/david-berenstein-1bab11105/
- Repositories: 2
- Profile: https://github.com/davidberenstein1957
👨🏽🍳 Cooking, 👨🏽💻 Coding, 🏆 Committing Developer Advocate @argilla-io
Citation (CITATION.cff)
cff-version: 1.0.0
message: "If you use this software, please cite it as below."
authors:
- family-names: David
given-names: Berenstein
title: "Fast `sentence-transformers` - simply, faster, sentence-transformers."
version: 0.4.0
date-released: 2022-12-12
GitHub Events
Total
- Issues event: 2
- Watch event: 10
Last Year
- Issues event: 2
- Watch event: 10
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| david | d****n@g****m | 42 |
| David Berenstein | d****n@p****m | 13 |
| arrmansa | 4****a | 1 |
| Tom Aarsen | C****v@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 18
- Total pull requests: 4
- Average time to close issues: 4 months
- Average time to close pull requests: 6 days
- Total issue authors: 15
- Total pull request authors: 4
- Average comments per issue: 1.17
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 24 days
- Issue authors: 4
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- davidberenstein1957 (4)
- remydeshayes (1)
- BinhMinhs10 (1)
- DoctorSlimm (1)
- mushuanli (1)
- nickmuchi87 (1)
- soharas (1)
- arrmansa (1)
- michaelfeil (1)
- brianmacy (1)
- DeoLeung (1)
- mgoldenbe (1)
- aoezdTchibo (1)
- himsgpt (1)
- mpetruc (1)
Pull Request Authors
- stephantul (2)
- arrmansa (1)
- davidberenstein1957 (1)
- tomaarsen (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- atomicwrites 1.4.0 develop
- attrs 21.4.0 develop
- black 22.3.0 develop
- cfgv 3.3.1 develop
- distlib 0.3.4 develop
- flake8 4.0.1 develop
- flake8-bugbear 22.3.23 develop
- flake8-docstrings 1.6.0 develop
- flake8-polyfill 1.0.2 develop
- identify 2.4.12 develop
- iniconfig 1.1.1 develop
- isort 5.10.1 develop
- mccabe 0.6.1 develop
- mypy-extensions 0.4.3 develop
- nodeenv 1.6.0 develop
- pathspec 0.9.0 develop
- pep8-naming 0.12.1 develop
- platformdirs 2.5.2 develop
- pluggy 1.0.0 develop
- pre-commit 2.18.1 develop
- py 1.11.0 develop
- pycodestyle 2.8.0 develop
- pydocstyle 6.1.1 develop
- pyflakes 2.4.0 develop
- pytest 7.1.1 develop
- snowballstemmer 2.2.0 develop
- toml 0.10.2 develop
- tomli 2.0.1 develop
- virtualenv 20.14.1 develop
- beautifulsoup4 4.11.1
- certifi 2021.10.8
- cffi 1.15.0
- charset-normalizer 2.0.12
- click 8.1.2
- colorama 0.4.4
- faiss-cpu 1.7.2
- fasttext 0.9.2
- filelock 3.6.0
- flatbuffers 2.0
- huggingface-hub 0.5.1
- idna 3.3
- imagehash 4.2.1
- joblib 1.1.0
- nltk 3.7
- numpy 1.23.0
- onnx 1.10.1
- onnxconverter-common 1.9.0
- onnxmltools 1.11.0
- onnxruntime 1.11.0
- onnxruntime-gpu 1.11.1
- packaging 21.3
- pandas 1.1.5
- pillow 9.2.0
- protobuf 3.20.0
- psutil 5.9.0
- pybind11 2.9.2
- pycparser 2.21
- pyparsing 3.0.8
- python-dateutil 2.8.2
- pytz 2022.1
- pywavelets 1.3.0
- pyyaml 6.0
- regex 2022.3.15
- requests 2.27.1
- sacremoses 0.0.49
- scikit-learn 1.0.2
- scipy 1.6.1
- sentence-transformers 2.2.0
- sentencepiece 0.1.96
- six 1.16.0
- skl2onnx 1.11.1
- soundfile 0.10.3.post1
- soupsieve 2.3.2.post1
- threadpoolctl 3.1.0
- tika 1.24
- timm 0.5.4
- tokenizers 0.12.1
- torch 1.11.0
- torchvision 0.12.0
- tqdm 4.64.0
- transformers 4.18.0
- txtai 4.5.0
- typing-extensions 3.10.0.2
- urllib3 1.26.9
- black ^22.3.0 develop
- flake8 ^4.0.1 develop
- flake8-bugbear ^22.3.23 develop
- flake8-docstrings ^1.6.0 develop
- isort ^5.10.1 develop
- pep8-naming ^0.12.1 develop
- pre-commit ^2.17.0 develop
- pytest ^7.0.1 develop
- Pillow >9.1
- numpy >=1.22
- onnxruntime-gpu >=1.8.1
- psutil ^5.9.0
- python >=3.8,<4.0
- sentence-transformers >=2.1.0
- txtai >=4.0
- actions/checkout v3 composite
- actions/setup-python v3 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite