1from sentence_transformers import SentenceTransformer
23# Download from the 🤗 Hub4model = SentenceTransformer("ronit01/golden_rag_tuned_minilm_mnr")5# Run inference6sentences =[7"How does RapidFire AI's concept of a 'config dictionary' with set-valued knobs relate to config groups and leaf configs, and why is this abstraction important for multi-config experimentation?",8'Run\n-----\n\nA central concept in RapidFire AI representing a single combination of configuration knob values\nfor a model trained with :func:`run_fit()`. \nIt is the same concept as in ML metrics dashboards such as MLflow and Weights & Biases. \nRapidFire AI assigns each run a unique integer :code:`run_id` within an experiment.\n',9' :param vector_store_cfg: The vector store type and args to store and possibly index embedding vectors for retrieval, provided as a single dictionary. \n \n - :code:`"type"`: The type of vector store to use. Must be one of :code:`"faiss"`, :code:`"pgvector"`, or :code:`"pinecone"`. Required.\n - :code:`"batch_size"`: Number of vectors per insert batch. Applies to all 3 types of stores. Optional; default is 128.\n\n The remaining keys are type-specific args as listed below. The vector store operates in one of 3 modes depending on the rest of the RAG spec:\n\n - **Create mode:** When :code:`document_loader` is provided and no pre-existing index/collection names are specified, a new vector store is *created* and populated from the loaded documents.\n - **Read mode:** When :code:`document_loader` is absent and pre-existing index/collection names are specified, the vector store is opened in *read-only* mode for retrieval against the existing index.\n - **Update mode:** When both :code:`document_loader` and pre-existing index/collection names are provided, the existing index/collection is *updated* with the new documents added to it.\n\n Supported vector store types and their arg keys:\n\n - **FAISS:** No additional keys. Uses a flat L2 index by default. Set :code:`enable_gpu_search=True` on the constructor to use GPU-accelerated FAISS. Only supports Create mode since it\'s an in-memory store that is not persistent. So, the notion of pre-existing indexes does not apply.\n\n - **Pinecone:**\n\n - :code:`"pinecone_api_key"`: Pinecone API key. Optional if the :code:`PINECONE_API_KEY` environment variable is set.\n - :code:`"index_namespace"`: A 2-tuple of strings (:code:`tuple[str, str]`) with index name and namespace. Required for Read/Update mode and must be a pre-existing index and namespace (NB: namespace can be empty string :code:`""` in Pinecone). N/A for Create mode.\n - :code:`"spec"`: A :code:`ServerlessSpec` or :code:`PodSpec` instance specifying the Pinecone deployment (e.g., cloud and region). Required for Create mode. N/A for Read/Update mode.\n - :code:`"metric"`: Distance metric for the index, must be one of :code:`"cosine"`, :code:`"euclidean"`, or :code:`"dotproduct"`. Optional for Create mode; default is :code:`"cosine"`. N/A for Read/Update mode.\n - :code:`"embedding_cfg"`: Embedding config dict (same format as the top-level :code:`embedding_cfg`). Required for any mode either here or in the top-level config for any mode. If provided here, *this takes precedence* over the top-level embedding config. For Create mode, we recommend providing it in the top-level config unless you want to couple different embedding configs with different vector stores.\n - :code:`"text_key"`: The metadata field name used to store the original raw text content associated with a vector in Pinecone. Optional; default is :code:`"text"`. 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:`"content"`, :code:`"original_text"`).\n - :code:`"vector_type"`: Vector type for the index. Accepts a :code:`VectorType` value or string. Optional for Create mode; default is :code:`"dense"`. N/A for Read/Update mode.\n - :code:`"tags"`: Arbitrary string key-value tags to attach to the index. Optional for Create mode; default is :code:`None`. N/A for Read/Update mode.\n - :code:`"timeout"`: Timeout in seconds for index operations. Optional for Create mode; default is :code:`None`. N/A for Read/Update mode.\n - :code:`"deletion_protection"`: Whether deletion protection is enabled. Accepts a :code:`DeletionProtection` value or string. Optional for Create mode; default is :code:`"disabled"`. N/A for Read/Update mode.\n\n To recap, for all 3 modes :code:`"pinecone_api_key"` is needed either here or as an environment variable; :code:`embedding_cfg` is also required either here or in the top-level config. The :code:`"text_key"` is optional for all modes and defaults to :code:`"text"`. \n \n For Create mode, :code:`"spec"` is required but the following are all optional: :code:`"metric"`, :code:`"vector_type"`, :code:`"tags"`, :code:`"timeout"`, and :code:`"deletion_protection"`. Although the argument :code:`"index_namespace"` is inapplicable, internally RapidFire AI creates an index name automatically with prefix "rf-" and an SHA hash per pre-processing worker to avoid naming conflicts; the namespace created is the default empty string.\n \n For Read/Update mode, :code:`"index_namespace"` is required and must point to a pre-existing index and namespace. All the other arguments are inapplicable.\n\n - **Postgres PGVector:**\n\n - :code:`"connection"`: DB connection string or engine. Required for all modes.\n - :code:`"collection_name"`: A pre-existing PGVector collection/table name to use for retrieval. Required for Read/Update mode. Inapplicable to Create mode; an SHA-based random name will be generated.\n - :code:`"embedding_cfg"`: Same explanation as above under Pinecone.\n - :code:`"pre_delete_collection"`: If :code:`True`, *deletes* the collection if it already exists before writing. **Use with caution.** Optional; default is :code:`False`. Applicable only to Update mode.\n\n The store is built from the documents provided via :code:`document_loader`. If this entire config is skipped, a default FAISS flat vector store will be created automatically.\n :type vector_store_cfg: dict[str, Any], optional',10]11embeddings = model.encode(sentences)12print(embeddings.shape)13# [3, 384]1415# Get the similarity scores for the embeddings16similarities = model.similarity(embeddings, embeddings)17print(similarities)18# tensor([[1.0000, 0.5984, 0.3058],19# [0.5984, 1.0000, 0.2532],20# [0.3058, 0.2532, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
Size: 111 training samples
Columns: sentence_0 and sentence_1
Approximate statistics based on the first 111 samples:
sentence_0
sentence_1
type
string
string
details
min: 15 tokens
mean: 41.97 tokens
max: 70 tokens
min: 36 tokens
mean: 227.35 tokens
max: 256 tokens
Samples:
sentence_0
sentence_1
What are all the Experiment class methods (experiment ops) provided by RapidFire AI, and what does each one do?
Experiment Constructor [object Object]------[object Object][object Object]Constructor to instantiate a new experiment. [object Object][object Object].. py:function:: [object Object](self, experiment_name: str, mode: str = "fit", experiments_path: str = "./rapidfire_experiments") -> None[object Object][object Object] :param experiment_name: Unique name for this experiment[object Object] :type experiment_name: str[object Object] [object Object] :param mode: Mode of this experiment, either :code:[object Object] or :code:[object Object]; default is :code:[object Object][object Object] :type mode: str[object Object] [object Object] :param experiments_path: Path to a folder to store this experiment's artifacts. Default is [object Object])[object Object] :type experiments_path: str, optional [object Object][object Object] :return: None[object Object] :rtype: None[object Object]
What are all the parameters accepted by the RFOpenAIAPIModelConfig class, and what does each one configure?
RFOpenAIAPIModelConfig
This is a wrapper around OpenAI's API client config and chat completion parameters.
The full list of their arguments are available on this page <https://platform.openai.com/docs/api-reference/chat/create>__.
The difference here is that the individual arguments (knobs) can be :class:List valued or
:class:Range valued in an :class:RFOpenAIAPIModelConfig.
That is how you can specify a base set of knob combinations from which a config group can
be produced. Also read :doc:the Multi-Config Specification page</configs>.
.. py:class:: RFOpenAIAPIModelConfig
:param client_config: A dictionary necessary for initializing the AsyncOpenAI client. All knobs given in this dictionary are simply passed to the AsyncOpenAI client as is. We recommend listing at least the following knobs.
* :code:`"api_key"`: Your OpenAI API key for authentication. Note that we are NOT able to provide a publicly visible API key.
* :code:`"max_retries"`: Maximum ...</code> |
| How do RFvLLMModelConfig and RFOpenAIAPIModelConfig compare in terms of their configuration parameters, underlying systems, rate limiting capabilities, and typical use cases? | RFOpenAIAPIModelConfig