Instructions to use ronit01/rag_tuned_minilm_mnr_50epoch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ronit01/rag_tuned_minilm_mnr_50epoch with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ronit01/rag_tuned_minilm_mnr_50epoch") sentences = [ "What parameters does the Experiment constructor accept?", "The crux of RapidFire AI's difference is in its *adaptive execution engine*: it enables \"interruptible\"\nexecution of configurations across GPUs/CPUs. To do so, it first shards the training and/or evaluation \ndataset randomly into \"chunks\" (also called \"shards\").\nThen instead of waiting for a run to see the whole dataset for all epochs (for SFT/RFT) or for full \neval metrics calculation (for RAG evals), RapidFire AI schedules all runs on *one shard at a time*, \nand then cycles through all shards.\n\nSuppose you have only 1 GPU, say an A100 or H100, and you want to run SFT on a Llama model. \nCurrent tools force you to run one config after another *sequentially* as shown in the (simplified) illustration below. \nIn contrast, by operating on shards, RapidFire AI offers a far more concurrent learning experience by \nautomatically *swapping* adapters (and base models, if needed) across GPU(s) and DRAM. \nIt does this via efficient shared memory-based caching mechanisms that can spill to disk when needed.\n\n.. image:: /images/gantt-1gpu.png\n :width: 800px\n\nIn the above figure, all 3 model configs are shown for 1 epoch. RapidFire AI is set to use 4 chunks.\nSo, before model config 3 (M3) even starts in the sequential approach, RapidFire AI already shows you \nthe learning behaviors of all 3 configs on the first 2-3 chunks. \nThe overhead of swapping, represented by the thin gray box, is minimal, less than 5% of the runtime,\nas per our measurements--thanks to our new efficient memory management techniques.\n\nFor inference evals for RAG/context engineering, such sharded execution means RapidFire AI surfaces eval metrics \nsooner based on a statistical technique known as *online aggregation* from the database systems literature.\nBasically, see estimated values and confidence intervals for all eval metrics in real time as the shards \nget processed, ultimately converging to the exact metrics on the full dataset.", ".. py:function:: __init__(self, experiment_name: str, mode: str = \"fit\", experiments_path: str = \"./rapidfire_experiments\") -> None\n\n\t:param experiment_name: Unique name for this experiment\n\t:type experiment_name: str\n\t\n\t:param mode: Mode of this experiment, either :code:`\"fit\"` or :code:`\"eval\"`; default is :code:`\"fit\"`\n\t:type mode: str\n\t\n\t:param experiments_path: Path to a folder to store this experiment's artifacts. Default is ``\"./rapidfire_experiments\"``)\n\t:type experiments_path: str, optional \n\n\t:return: None\n\t:rtype: None", "just start rapidfireai again with the above command.\n\nIf the start command fails for whatever reason, wait for half a minute and rerun it.\nFor diagnostics and common fixes (including Linux/macOS and Windows steps), see :doc:`Troubleshooting </troubleshooting>`.\n" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for retrieval.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/all-MiniLM-L6-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
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({})
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("ronit01/rag_tuned_minilm_mnr_50epoch")
# Run inference
sentences = [
'What are all the parameters accepted by the RFOpenAIAPIModelConfig class, and what does each one configure?',
'RFOpenAIAPIModelConfig\n------\n\nThis is a wrapper around OpenAI\'s API client config and chat completion parameters. \nThe full list of their arguments are available on `this page <https://platform.openai.com/docs/api-reference/chat/create>`__.\n\nThe difference here is that the individual arguments (knobs) can be :class:`List` valued or \n:class:`Range` valued in an :class:`RFOpenAIAPIModelConfig`. \nThat is how you can specify a base set of knob combinations from which a config group can \nbe produced. Also read :doc:`the Multi-Config Specification page</configs>`.\n\n.. py:class:: RFOpenAIAPIModelConfig\n\n :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.\n \n * :code:`"api_key"`: Your OpenAI API key for authentication. Note that we are NOT able to provide a publicly visible API key.\n * :code:`"max_retries"`: Maximum number of retry attempts for failed API calls. Default is 2.\n * :code:`"timeout"`: Request timeout in seconds. Optional.\n \n :type client_config: dict[str, Any]\n\n :param model_config: A dictionary to control the chat completion behavior with OpenAI\'s Chat Completions API. All knobs given in this dictionary are simply passed to the OpenAI API as is. The API will use its defaults for unspecified knobs. We recommend listing at least the following knobs.\n\n * :code:`"model"`: Name of the OpenAI model to use, e.g., "gpt-5-mini".\n * :code:`"temperature"`: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. OpenAI recommends altering this or :code:`"top_p"` but not both.\n * :code:`"max_completion_tokens"`: Upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.\n * :code:`"reasoning_effort"`: Constrains effort for reasoning models. Currently supported values are "minimal", "low", "medium", and "high". Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. The gpt-5-pro model defaults to (and only supports) "high" reasoning effort.\n\t* :code:`"top_p"`: Alternative to temperature-based sampling called nucleus sampling. The model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. OpenAI recommends altering this or :code:`"temperature"` but not both.\n\n :type model_config: dict[str, Any]\n\n :param rpm_limit: Rate limit for requests per minute to the OpenAI API. Used for throttling to avoid exceeding Open AI API quotas. Check the rate limit published by Open AI for details on your tier and the latest per-model limits on `this page <https://platform.openai.com/docs/guides/rate-limits>`__.\n :type rpm_limit: int\n\n :param tpm_limit: Rate limit for tokens per minute to the OpenAI API. Used for throttling to avoid exceeding API quotas. See the rate limit page above for details.\n :type tpm_limit: int\n\n :param rag: An instance of a RapidFire AI RAG pipeline spec. Also read :doc:`the API: RFLangChainRagSpec page </ragspecs>`.\n :type rag: RFLangChainRagSpec\n\n :param prompt_manager: An instance of a RapidFire AI PromptManager. Also read :doc:`the API: Prompt Manager and Other Eval Config Knobs page </promptothers>`.\n :type prompt_manager: PromptManager\n\n .. seealso::\n - `OpenAI Chat Completions API Reference <https://platform.openai.com/docs/api-reference/chat/create>`_\n - `OpenAI Python Client Documentation <https://github.com/openai/openai-python>`_\n - :doc:`API: RFLangChainRagSpec </ragspecs>`\n - :doc:`API: Prompt Manager and Other Eval Config Knobs page </promptothers>`\n\n\n**Example:**\n\n.. code-block:: python\n\n\t# Based on GSM8K chatbot tutorial notebook; specify your OPENAI_API_KEY beforehand\n\topenai_config1 = RFOpenAIAPIModelConfig(\n\t\tclient_config={"api_key": OPENAI_API_KEY, "max_retries": 2},\n\t\tmodel_config={\n\t\t\t"model": "gpt-5-mini",\n\t\t\t"max_completion_tokens": 1024,\n\t\t\t"reasoning_effort": "medium", \n\t\t},\n\t\trpm_limit=500,\n\t\ttpm_limit=500_000,\n\t\trag=None,\n\t\tprompt_manager=fewshot_prompt_manager,\n\t)\t',
'As of this writing, we support 4 IC Ops: **Stop**, **Resume**, **Clone-Modify**, and **Delete**. \nWe explain each shortly below.\n\nAll IC Ops on a run are queued by the system and **executed at a chunk boundary** for that run. \nThis avoids potentially non-deterministic or other inconsistent behaviors during concurrent run execution.\nNote that different runs might reach their chunk boundary at different points in time. \nTo control the number of chunks, set :code:`num_chunks` during :func:`run_fit()`; \nmore details :doc:`on the Experiment docs page </experiments>`.\n\nIC ops can be invoked as intermittently as you want during a long-running :func:`run_fit()`. \nSo, you can launch, say, 16 configs in one go (even on a 4-GPU machine), check in after a few chunks, \nand stop bottom 80% of the runs. You can let the top performers continue for longer. Then you can \nclone and modify some to add new finer grained runs and warm start their parameters. And so on.\n\nUnder the hood, RapidFire AI automatically adjusts the apportioning of the GPUs among all ongoing \nruns to ensure maximal GPU utilization.\n\n\n\n\nStop\n----\n\nThis IC Op earmarks a run to be stopped at the end of its current chunk. \nIt will still be alive but it will not use any GPU resources from the next chunk. \nYou will still see its minibatch-level plots advancing for the current chunk. \nYou cannot stop an already stopped or deleted run. \n\n\n.. raw:: html\n\n <img src="/ronit01/rag_tuned_minilm_mnr_50epoch/resolve/main/_static/icop-stop2.png" alt="IC Op Stop" \n style="cursor: zoom-in; max-width: 100%;" onclick="this.requestFullscreen()">\n\n <img src="/ronit01/rag_tuned_minilm_mnr_50epoch/resolve/main/_static/icop-stop.png" alt="IC Op Stop" \n style="cursor: zoom-in; max-width: 100%;" onclick="this.requestFullscreen()">\n\n\nResume\n-----\n\nThis IC Op is applicable only to a previously stopped run. \nIt earmarks this run to be resumed from the next chunk onward, when it will be added to the mix of \nongoing runs and assigned GPU(s) automatically. \nYou cannot resume an already resumed or deleted run.\n\n\n\nClone-Modify\n----\n\nThis is a powerful IC Op that is applicable to any ongoing, stopped, or resumed run. \nIt allows you to add "clones" of a chosen run, called the "parent" run, during a :func:`run_fit()`. \nThe IC Op panel displays an editable text box with the full knob config dictionary of the parent. \n\nEdit any knobs, e.g., learning rate, LoRA rank, or even base model as if you are injecting \nthat new run config from code, except this is done conveniently from the metrics dashboard itself. \nAs of this writing, we only support providing a single config for this IC Op.\nSoon we will support providing a config-group generator such as :code:`RFGridSearch()` or\n:code:`RFRandomSearch()` as well in the IC Op panel itself akin to the launching code.\n\nYou can also **warm-start** a clone using its parent\'s weights if you\'d like. \nWarm-started clones inherit their parent\'s learning behavior so far and thus, they can reach better \neval metrics faster. \nNote that warm starting is only allowed if the clones have *identical* neural architecture as the \nparent, including LoRA adapters; otherwise, it will error out.\n\nWhen you are ready with your clone\'s config, click "Submit" to execute this IC Op.\n\n\n.. raw:: html\n\n <img src="/ronit01/rag_tuned_minilm_mnr_50epoch/resolve/main/_static/icop-clone2.png" alt="IC Op Clone-Modify" \n style="cursor: zoom-in; max-width: 100%;" onclick="this.requestFullscreen()">\n\n <img src="/ronit01/rag_tuned_minilm_mnr_50epoch/resolve/main/_static/icop-clone.png" alt="IC Op Clone-Modify" \n style="cursor: zoom-in; max-width: 100%;" onclick="this.requestFullscreen()">\n\n\nClones will automatically appear on the plots from the next chunk onward; just refresh the page. \nRapidFire AI\'s adaptive scheduler automatically reapportions GPUs across all runs, including clones.\nSo, do not need to worry about manually splitting GPUs across models, juggling new processes, etc.\nClones are treated just like any other run; so, you can clone that clone later with IC Ops again.\n\nYou can submit multiple Clone-Modify ops on the same run or different runs whenever you want. \nThey will get queued up and all clones will start together at the next chunk boundary. \n\nClone-Modify combined with Stop enables you to turbocharge how you leverage your intuition about your \nAI use case, dataset, models, and eval metrics to dramatically cut down time to reaching much better \neval metrics even within a single experiment.\n\n\n\nDelete\n----\n\nThis IC Op earmarks the run to be deleted from the next chunk onward. \nOn the chart, you will see its curves vanish almost immediately. \nYou cannot do any further IC Ops on a deleted run because it will not be visible. \nNote that although a deleted run vanishes from the plots, its model checkpoints are still part of \nthe artifacts of that experiment so that you have post-hoc audibility.\n',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000, 0.6151, -0.0372],
# [ 0.6151, 1.0000, -0.0128],
# [-0.0372, -0.0128, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
Size: 46 training samples
Columns:
sentence_0andsentence_1Approximate statistics based on the first 46 samples:
sentence_0 sentence_1 type string string details - min: 11 tokens
- mean: 30.57 tokens
- max: 48 tokens
- min: 64 tokens
- mean: 225.52 tokens
- max: 256 tokens
Samples: | sentence_0 | sentence_1 | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
What rate limiting parameters does RFOpenAIAPIModelConfig provide, and why are they needed?|When using only closed model APIs such as OpenAI, RapidFire AI's scheduler automatically| |
optimizes how CPU cores and the token rate limits are apportioned across configs.
This will help avoid wastage of token spend on unproductive RAG configs and help you
redirect the spend to more productive RAG configs in real time.How do the Stop and Delete IC Ops compare in terms of their effects on a run's state, visibility on the dashboard, resource usage, artifact preservation, and what further IC Ops can be performed on the run afterward?|Delete| |
----
This IC Op earmarks the run to be deleted from the next chunk onward.
On the chart, you will see its curves vanish almost immediately.
You cannot do any further IC Ops on a deleted run because it will not be visible.
Note that although a deleted run vanishes from the plots, its model checkpoints are still part of
the artifacts of that experiment so that you have post-hoc audibility.What user-provided functions can be included in an eval config for run_evals(), and which are mandatory vs. optional?|Eval Accumulate Metrics FunctionOptional user-provided function to aggregate algebraic eval metrics across all batches of the data. If this function is not provided, all metrics returned by :func:
eval.compute_metrics_fn()will be assumed to be distributive (i.e., summed across batches) by default. Use this function when metrics require (weighted) averaging or other custom dataset-wide aggregation logic.It is invoked once at the very end of the evaluation process after all batches have been processed. Pass it directly to the :code:
accumulate_metrics_fnkey in your eval config dictionary... py:function:: eval.accumulate_metrics_fn(aggregated_metrics: dict[str, list[dict[str, Any]]]) -> dict[str, dict[str, Any]]
:param aggregated_metrics: Dictionary with a metric's name as key and a list of per-batch metric dictionaries as values from across all data batches. Inside each value dictionary, at least the reserved key :code:|"value"will exist t...Loss:
MultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 50multi_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
do_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16gradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 50max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}
Training Time
- Training: 24.5 seconds
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.4.1
- Transformers: 5.0.0
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0
- Datasets: 4.0.0
- Tokenizers: 0.22.2
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MultipleNegativesRankingLoss
@misc{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}
- Downloads last month
- 6
Model tree for ronit01/rag_tuned_minilm_mnr_50epoch
Base model
nreimers/MiniLM-L6-H384-uncased