Views
No views yet
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("ronit01/golden_rag_tuned_minilm_mnr_100")
5# Run inference
6sentences = [
7 'How do you define and wire together the accumulate_metrics_fn for algebraic metrics in a RAG evals pipeline, and what happens if you omit it?',
8 'Types of Metrics\n-----------------------\n\nWe support 2 types of metrics based on their aggregation semantics: \n\n* **Distributive Metrics:** These are purely additive over a given set of data points. \n \n Examples: *count* of number of correct predictions; *sum* of output token lengths across queries.\n\n* **Algebraic Metrics:** These are averages or proportions over a given set of data points. They can be decomposed into components that are individually distributive. \n \n Examples: *precision*, which counts number of correct predictions and total number of data points separately and then divides them; *mean rouge-1*, which averages per-example rouge-1 values that assesses overlap of tokens between generated text and ground truth text.\n\nWhen you define an eval metric via :func:`evals.compute_metrics_fn()` and :func:`evals.accumulate_metrics_fn()`, \nyou must specify their type (algebraic or distributive) and value range as illustrated below. \nFor metrics without a type defined, they will be displayed *as is*, i.e., without projected \nestimates or confidence intervals.\n\n.. code-block:: python\n\n # Based on GSM8K tutorial use case\n metrics = {\n "Total": {"value": total},\n "Correct": {\n "value": correct,\n "is_distributive": True,\n "value_range": (0, 1),\n },\n "Accuracy": {\n "value": accuracy,\n "is_algebraic": True,\n "value_range": (0, 1),\n },\n }',
9 'Postprocess Function\n--------------------\n\nOptional user-provided function to postprocess a batch of examples and their respective generated outputs, \nwhich is injected into this function by the system. \nThis is useful for, say, extracting structured information from generations, adding ground truth data, \nor performing any transformations needed before computing metrics.\n\nIt is invoked for each batch during the evaluation process after generation and before metric computation.\nPass it directly to the :code:`postprocess_fn` key in your eval config dictionary.\n',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 384]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.6599, 0.2692],
19# [0.6599, 1.0000, 0.2501],
20# [0.2692, 0.2501, 1.0000]])sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
How does the num_shards parameter in run_evals() relate to the online aggregation confidence interval computation, and what is the end-to-end flow from setting num_shards to seeing narrowing confidence intervals on eval metrics? | |
| .. py:function:: run_evals(self, config_group: Any, dataset: Dataset, num_shards: int=4, num_actors: int, seed: int=42) -> dict[int, tuple[dict, dict]]: |
list of configs or config groups
:type config_group: Evals config-group or list as described in :doc:the Multi-Config Specification page</configs>What is the default value of the text_key metadata field name used to store raw text content in Pinecone vector store configurations? | - :code:[object Object]: The metadata field name used to store the original raw text content associated with a vector in Pinecone. Optional; default is :code:[object Object]. Applicable to all modes. This is useful when the Pinecone index was populated by an external tool that stored text under a non-default metadata field name (e.g., :code:[object Object], :code:[object Object]).
- :code:[object Object]: Vector type for the index. Accepts a :code:[object Object] value or string. Optional for Create mode; default is :code:[object Object]. N/A for Read/Update mode.
- :code:[object Object]: Arbitrary string key-value tags to attach to the index. Optional for Create mode; default is :code:[object Object]. N/A for Read/Update mode.
- :code:[object Object]: Timeout in seconds for index operations. Optional for Create mode; default is :code:[object Object]. N/A for Read/Update mode.
- :code:[object Object]: Whether deletion protection is enabled. Accepts a :code:[object Object] ... |
| How do FAISS, Pinecone, and PGVector compare as vector store options in RapidFire AI in terms of supported modes, persistence, configuration requirements, and GPU support? | :param vector_store_cfg: The vector store type and args to store and possibly index embedding vectors for retrieval, provided as a single dictionary.
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]