Run this model with HF Jobs
Run enguard/tiny-guard-2m-en-response-safety-binary-polyguard 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/enguard/tiny-guard-2m-en-response-safety-binary-polyguard. 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/enguard/tiny-guard-2m-en-response-safety-binary-polyguard 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 enguard/tiny-guard-2m-en-response-safety-binary-polyguard with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Model2Vec
How to use enguard/tiny-guard-2m-en-response-safety-binary-polyguard with Model2Vec:
from model2vec import StaticModel model = StaticModel.from_pretrained("enguard/tiny-guard-2m-en-response-safety-binary-polyguard") embeddings = model.encode(["It's dangerous to go alone!", "It's a secret to everybody."]) print(embeddings.shape) - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse filesFiles changed (7)
- .gitattributes+1
- README.mdAdded+100
- config.jsonAdded+5
- model.safetensorsAdded+3
- modules.jsonAdded+14
- pipeline.skopsAdded+3
- tokenizer.jsonAdded
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textpipeline.skops filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---base_model: unknownlibrary_name: model2veclicense: mitmodel_name: tmpd_cg9xbjtags:- embeddings- static-embeddings- sentence-transformers---
# tmpd_cg9xbj Model Card
This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the unknown(https://huggingface.co/unknown) Sentence Transformer. It uses static embeddings, allowing text embeddings to be computed orders of magnitude faster on both GPU and CPU. It is designed for applications where computational resources are limited or where real-time performance is critical. Model2Vec models are the smallest, fastest, and most performant static embedders available. The distilled models are up to 50 times smaller and 500 times faster than traditional Sentence Transformers.
## Installation
Install model2vec using pip:```pip install model2vec```
## Usage
### Using Model2Vec
The [Model2Vec library](https://github.com/MinishLab/model2vec) is the fastest and most lightweight way to run Model2Vec models.
Load this model using the `from_pretrained` method:```pythonfrom model2vec import StaticModel
# Load a pretrained Model2Vec modelmodel = StaticModel.from_pretrained("tmpd_cg9xbj")
# Compute text embeddingsembeddings = model.encode(["Example sentence"])```
### Using Sentence Transformers
You can also use the [Sentence Transformers library](https://github.com/UKPLab/sentence-transformers) to load and use the model:
```pythonfrom sentence_transformers import SentenceTransformer
# Load a pretrained Sentence Transformer modelmodel = SentenceTransformer("tmpd_cg9xbj")
# Compute text embeddingsembeddings = model.encode(["Example sentence"])```
### Distilling a Model2Vec model
You can distill a Model2Vec model from a Sentence Transformer model using the `distill` method. First, install the `distill` extra with `pip install model2vec[distill]`. Then, run the following code:
```pythonfrom model2vec.distill import distill
# Distill a Sentence Transformer model, in this case the BAAI/bge-base-en-v1.5 modelm2v_model = distill(model_name="BAAI/bge-base-en-v1.5", pca_dims=256)
# Save the modelm2v_model.save_pretrained("m2v_model")```
## How it works
Model2vec creates a small, fast, and powerful model that outperforms other static embedding models by a large margin on all tasks we could find, while being much faster to create than traditional static embedding models such as GloVe. Best of all, you don't need any data to distill a model using Model2Vec.
It works by passing a vocabulary through a sentence transformer model, then reducing the dimensionality of the resulting embeddings using PCA, and finally weighting the embeddings using [SIF weighting](https://openreview.net/pdf?id=SyK00v5xx). During inference, we simply take the mean of all token embeddings occurring in a sentence.
## Additional Resources
- [Model2Vec Repo](https://github.com/MinishLab/model2vec)- [Model2Vec Base Models](https://huggingface.co/collections/minishlab/model2vec-base-models-66fd9dd9b7c3b3c0f25ca90e)- [Model2Vec Results](https://github.com/MinishLab/model2vec/tree/main/results)- [Model2Vec Docs](https://minish.ai/packages/model2vec/introduction)
## Library Authors
Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team consisting of [Stephan Tulkens](https://github.com/stephantul) and [Thomas van Dongen](https://github.com/Pringled).
## Citation
Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.```@software{minishlab2024model2vec, author = {Stephan Tulkens and {van Dongen}, Thomas}, title = {Model2Vec: Fast State-of-the-Art Static Embeddings}, year = {2024}, publisher = {Zenodo}, doi = {10.5281/zenodo.17270888}, url = {https://github.com/MinishLab/model2vec}, license = {MIT}}```12345{ "normalize": true, "embedding_dtype": "float32", "vocabulary_quantization": 29528}123version https://git-lfs.github.com/spec/v1oid sha256:db6a5160f023e7f3295ae8d00ad9d7037ebf1647b579e3c33f96a998773c08f6size 79137361234567891011121314[ { "idx": 0, "name": "0", "path": ".", "type": "sentence_transformers.models.StaticEmbedding" }, { "idx": 1, "name": "1", "path": "1_Normalize", "type": "sentence_transformers.models.Normalize" }]123version https://git-lfs.github.com/spec/v1oid sha256:391fc4d082940127862da0a0f12d0141d93298887a81040b6e698fe06c3a6d8esize 1027768.gitattributes+1
README.mdAdded+100
config.jsonAdded+5
model.safetensorsAdded+3
modules.jsonAdded+14
pipeline.skopsAdded+3
tokenizer.jsonAdded