Sentence Similarity
sentence-transformers
Safetensors
English
roberta
feature-extraction
dense
Generated from Trainer
dataset_size:900
loss:MatryoshkaLoss
loss:MultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use shubharuidas/codebert-embed-base-dense-retriever with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use shubharuidas/codebert-embed-base-dense-retriever with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("shubharuidas/codebert-embed-base-dense-retriever") sentences = [ "Best practices for _invocation_params", "def after_model(self, state: StateT, runtime: Runtime[ContextT]) -> dict[str, Any] | None:\n \"\"\"Logic to run after the model is called.\n\n Args:\n state: The current agent state.\n runtime: The runtime context.\n\n Returns:\n Agent state updates to apply after model call.\n \"\"\"", "def _get_trace_callbacks(\n project_name: str | None = None,\n example_id: str | UUID | None = None,\n callback_manager: CallbackManager | AsyncCallbackManager | None = None,\n) -> Callbacks:\n if _tracing_v2_is_enabled():\n project_name_ = project_name or _get_tracer_project()\n tracer = tracing_v2_callback_var.get() or LangChainTracer(\n project_name=project_name_,\n example_id=example_id,\n )\n if callback_manager is None:\n cb = cast(\"Callbacks\", [tracer])\n else:\n if not any(\n isinstance(handler, LangChainTracer)\n for handler in callback_manager.handlers\n ):\n callback_manager.add_handler(tracer)\n # If it already has a LangChainTracer, we don't need to add another one.\n # this would likely mess up the trace hierarchy.\n cb = callback_manager\n else:\n cb = None\n return cb", "def _invocation_params(self) -> dict[str, Any]:\n params: dict = {\"model\": self.model, **self.model_kwargs}\n if self.dimensions is not None:\n params[\"dimensions\"] = self.dimensions\n return params" ] 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!