1from sentence_transformers import SentenceTransformer
23# Download from the 🤗 Hub4model = SentenceTransformer("ronit01/final_golden_rag_tuned_minilm_contrastive_50epoch")5# Run inference6sentences =[7'What are the two knob set generators currently supported by RapidFire AI for creating multi-config specifications?',8'RapidFire AI offers a browser-based dashboard to automatically visualize all ML metrics and lets \nyou control runs on the fly from there. \nOur current default dashboard is a fork of the popular OSS tool `MLflow <https://mlflow.org/>`__, \nand it inherits much of MLflow\'s native features.\nThe dashboard URI is printed when the rapidfireai server is started; open it in a browser. \n\nAs of this writing, apart from MLflow, RapidFire AI also supports \n`TensorBoard <https://www.tensorflow.org/tensorboard>`__\nand `Trackio <https://huggingface.co/docs/trackio/en/index>`__\nfor logging metrics plots. \nSpecify any one, two, or all three dashboards to use with the following server start argument. \n\n.. code-block:: bash\n\n rapidfireai start --tracking-backends [mlflow | tensorboard | trackio]\n\nAlternatively, set the dashboard using its environment variable as below in your python code/notebook:\n\n.. code-block:: python\n\n os.environ["RF_MLFLOW_ENABLED"] = "true"\n os.environ["RF_TENSORBOARD_ENABLED"] = "true"\n os.environ["RF_TRACKIO_ENABLED"] = "true"\n\nSupport for other popular dashboards such as Weights & Biases and CometML is coming soon. \nThe rest of this section explains the new features of our MLflow-fork dashboard.\nNote that these new features are not yet available on the other dashboards.',9'Compute Metrics Function\n------\n\nOptional user-provided function specifying custom evaluation metrics based on the generated \noutputs and ground truth.\n\nIt is passed to the :code:`compute_metrics` argument of :class:`RFModelConfig`. \nAlso read: :doc:`the LoRA and Model Configs page</models>`.\nYou can create multiple variants of these functions and pass them all as a single \n:code:`List` to your :class:`RFModelConfig` to create a multi-config specification.\n\nThis function is invoked by the underlying HF trainer at a cadence controlled by the \n:code:`eval_strategy` and :code:`eval_steps` arguments.\nAlso read: :doc:`the Trainer Configs page</trainers>`.\n\n.. py:function:: fit.compute_metrics_fn(eval_preds: Tuple) -> Dict[str, float]\n\n :param eval_preds: Tuple containing generated predictions and ground truth labels from the eval dataset.\n :type eval_preds: Tuple[List[str], List[str]]\n\n :return: Dictionary with user-defined metrics with names keys and numbers as values\n :rtype: Dict[str, float]\n\n\n**Example:**\n\n.. code-block:: python\n\n\t# From the SFT tutorial notebook\n\tdef sample_compute_metrics(eval_preds): \n\t\t"""Optional function to compute eval metrics based on predictions and labels"""\n\t\tpredictions, labels = eval_preds\n\n\t\t# Standard text-based eval metrics: Rouge and BLEU\n\t\timport evaluate\n\t\trouge = evaluate.load("rouge")\n\t\tbleu = evaluate.load("bleu")\n\n\t\trouge_output = rouge.compute(predictions=predictions, references=labels, use_stemmer=True)\n\t\trouge_l = rouge_output["rougeL"]\n\t\tbleu_output = bleu.compute(predictions=predictions, references=labels)\n\t\tbleu_score = bleu_output["bleu"]\n\n\t\treturn {"rougeL": round(rouge_l, 4), "bleu": round(bleu_score, 4)}',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.3398, 0.4086],19# [0.3398, 1.0000, 0.6458],20# [0.4086, 0.6458, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
Size: 276 training samples
Columns: sentence_0, sentence_1, and label
Approximate statistics based on the first 276 samples:
sentence_0
sentence_1
label
type
string
string
float
details
min: 11 tokens
mean: 30.57 tokens
max: 48 tokens
min: 64 tokens
mean: 231.63 tokens
max: 256 tokens
min: 0.0
mean: 0.17
max: 1.0
Samples:
sentence_0
sentence_1
label
How do you select specific GPUs for RapidFire AI to use, and how do you resolve port conflicts when starting the server?
Port conflicts (services already running)[object Object]----------------------------------------[object Object][object Object]If you encounter port conflicts, you can kill existing processes.[object Object][object Object].. code-block:: bash[object Object][object Object] lsof -t -i:8852 | xargs kill -9 # mlflow[object Object] lsof -t -i:8851 | xargs kill -9 # dispatcher[object Object] lsof -t -i:8853 | xargs kill -9 # frontend server[object Object][object Object]Select specific GPU(s) to use[object Object]-----------------------------[object Object][object Object]Set the [object Object] environment variable BEFORE running [object Object] to control which GPU(s) RapidFire can see and use.[object Object][object Object].. code-block:: bash[object Object][object Object] export CUDA_VISIBLE_DEVICES=2 # use GPU index 2 only[object Object] rapidfireai start[object Object][object Object]Multiple GPUs (example: GPUs 0 and 2):[object Object][object Object].. code-block:: bash[object Object][object Object] export CUDA_VISIBLE_DEVICES=0,2[object Object] rapidfireai start[object Object][object Object]From a Python script (set before importing/starting RapidFire):[object Object][object Object].. code-block:: python[object Object][object Object] import os[object Object] os.environ["CUDA_VISIBLE_DEVICES"] = "2"[object Object] # then start your RapidFire workflow[object Object]
1.0
How do you install and initialize RapidFire AI for fine-tuning workflows, and what steps are required to access gated Hugging Face models?
Eval Accumulate Metrics Function
Optional 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_fn key in your eval config dictionary.
: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... | 0.0 |
| What are the two knob set generators currently supported by RapidFire AI for creating multi-config specifications? |
RapidFire AI offers a browser-based dashboard to automatically visualize all ML metrics and lets
you control runs on the fly from there.
Our current default dashboard is a fork of the popular OSS tool [object Object]__,
and it inherits much of MLflow's native features.
The dashboard URI is printed when the rapidfireai server is started; open it in a browser.
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}
ContrastiveLoss
bibtex
1@inproceedings{hadsell2006dimensionality,
2 author={Hadsell, R. and Chopra, S. and LeCun, Y.},
3 booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
4 title={Dimensionality Reduction by Learning an Invariant Mapping},
5 year={2006},
6 volume={2},
7 number={},
8 pages={1735-1742},
9 doi={10.1109/CVPR.2006.100}
10}