Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
Generated from Trainer
dataset_size:475
loss:CosineSimilarityLoss
text-embeddings-inference
Instructions to use AShi846/all-MiniLM-L6-v2_rag_ft_e-7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use AShi846/all-MiniLM-L6-v2_rag_ft_e-7 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("AShi846/all-MiniLM-L6-v2_rag_ft_e-7") sentences = [ "Suppose we use the Simplex method to solve the following linear program: \\begin{align*} \\textbf{maximize} \\hspace{0.8cm} & \\hspace{0.4cm}4x_1 - 6x_2 + 4x_3 \\\\ \\textbf{subject to}\\hspace{0.6cm} & x_1 - 3x_2 + x_3 + s_1 = 1 \\\\ \\hspace{0.8cm} & \\hspace{1.90cm}x_1 + s_2 = 8 \\\\ \\hspace{0.8cm} & \\hspace{0.65cm} 3x_2 + 2x_3 + s_3 = 6 \\\\ \\hspace{0.8cm} &\\hspace{-0.35cm} x_1,\\: x_2, \\: x_3, \\:s_1, \\:s_2, \\:s_3 \\geq 0 \\end{align*} At the current step, we have the following Simplex tableau: \\begin{align*} \\hspace{1cm} x_1 &= 1 + 3x_2 - x_3 - s_1 \\\\ s_2 &= 7 -3x_2 + x_3 + s_1 \\\\ s_3 &= 6 - 3x_2 - 2x_3 \\\\ \\cline{1-2} z &= 4 + 6 x_2 - 4s_1 \\end{align*} Write the tableau obtained by executing one iteration (pivot) of the Simplex method starting from the above tableau.", "We want to assign each job to a machine. For any job $j$ which the LP assigns to a single machine $i$, i.e., $x^*_{ij} = 1$, it clearly makes sense to listen to the LP and assign $j$ to $i$. To assign the other jobs, we will use the graph $H$, which has the following properties: \\begin{itemize} \\item $H$ is acyclic, i.e., a forest. \\item Vertices corresponding to the already-assigned jobs are isolated. \\item Vertices corresponding to the yet-unassigned jobs have degree at least two. \\end{itemize} While $H$ contains an edge, we iteratively do the following: \\begin{itemize} \\item Choose a machine $i$ whose vertex $a_i$ has degree one in $H$, i.e., there is only a single edge $\\{a_i, b_j\\}$ incident to $a_i$. (Such a machine exists because $H$ is nonempty, and a nonempty forest contains a degree-one vertex; since job-vertices have degrees either zero or at least two, a degree-one vertex must be a machine-vertex.) \\item Assign job $j$ to machine $i$. \\item Remove all edges incident to $j$ from $H$. (Note that this preserves all the above properties of $H$.) \\end{itemize} Obviously, this procedure will terminate. Note that it will assign all jobs to machines, because as long as there is an unassigned job $j$, the vertex $b_j$ has at least two incident edges in $H$. It remains to reason that for every machine $i$, the sum of processing times of jobs assigned to $i$ (this is called the \\textit{makespan} of $i$) is at most $T + \\max_{j \\in J} p_j$. This is because there are two kinds of jobs assigned to $i$: \\begin{itemize} \\item Assigned in the beginning: the jobs $j$ which had $x^*_{ij} = 1$. The total processing time of these jobs is \\[ \\sum_{j\\in J: x^*_{ij} = 1} p_j = \\sum_{j\\in J: x^*_{ij} = 1} x^*_{ij} p_j \\le \\sum_{j\\in J: i \\in N(j)} x^*_{ij} p_j \\le T. \\] \\item Assigned later: at most one other job. For note that we only assign a job to $i$ when $a_i$ is of degree-one, and once we do, $a_i$ becomes isolated and no more jobs can be assigned to $i$. This job has processing time at most $\\max_{j \\in J} p_j$. \\end{itemize} Another perspective on the solution is the following. By looking at the makespan bound $T + \\max_j p_j$ that we should satisfy, we can notice that it will be fine if we assign the integral jobs to the machines that the LP has selected and the non-integral jobs in such a way that each machine gets at most one. In other words, we just need to prove that the graph $H$ has a matching which matches all non-integral jobs (any such matching will be fine). Our iterative procedure is one way to prove that such a matching exists.", "1", "It breaks backward compatibility, because the signature changes and \"Document\" is not a special kind of \"String\" thus callers will have to be updated" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Welcome to the community
The community tab is the place to discuss and collaborate with the HF community!