Sentence Similarity
sentence-transformers
Safetensors
English
modernbert
feature-extraction
dense
code
code-search
code-retrieval
text-embeddings-inference
Instructions to use Shuu12121/NightJar-large-CodeSearch-Embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Shuu12121/NightJar-large-CodeSearch-Embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Shuu12121/NightJar-large-CodeSearch-Embedding") sentences = [ "Extract json from string with support for '' and None.", "def json_loads(data: Any) -> dict[str, Any]:\n \"\"\"Extract json from string with support for '' and None.\"\"\"\n if not data:\n return {}\n try:\n return json_loads_util(data)\n except json.JSONDecodeError as err:\n raise APIError(\"Invalid json\") from err", "def str2json(v):\n \"\"\"\n convert str to json data\n :param v:\n :return:\n \"\"\"\n try:\n return json.loads(v)\n except:\n return None", "def extract_json_from_string(response_msg: str) -> str:\n \"\"\"\n Attempts to extract JSON (object or array) from within a larger string, not specific to markdown.\n \"\"\"\n json_pattern = re.compile(r\"\\{.*\\}|\\[.*\\]\")\n match = json_pattern.search(response_msg)\n if match:\n return match.group(0)\n\n return response_msg", "def parse_json(val: str):\n \"\"\"\n Parses json if string else return\n \"\"\"\n if isinstance(val, str):\n val = json.loads(val)\n if isinstance(val, dict):\n val = frappe._dict(val)\n return val" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [5, 5] - Notebooks
- Google Colab
- Kaggle
Download config.json from Shuu12121/NightJar-large-CodeSearch-Embedding: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/Shuu12121/NightJar-large-CodeSearch-Embedding/resolve/main/config.json
- Command line
-
hf download hf://Shuu12121/NightJar-large-CodeSearch-Embedding/config.json
-
curl -L -o config.json https://huggingface.co/Shuu12121/NightJar-large-CodeSearch-Embedding/resolve/main/config.json
1.26 kB
| { | |
| "architectures": [ | |
| "ModernBertModel" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "attention_probs_dropout_prob": 0.1, | |
| "bos_token_id": null, | |
| "classifier_activation": "silu", | |
| "classifier_bias": false, | |
| "classifier_dropout": 0.0, | |
| "classifier_pooling": "cls", | |
| "cls_token_id": 2, | |
| "decoder_bias": true, | |
| "deterministic_flash_attn": false, | |
| "dtype": "float32", | |
| "embedding_dropout": 0.0, | |
| "eos_token_id": null, | |
| "global_attn_every_n_layers": 3, | |
| "global_rope_theta": 160000.0, | |
| "hidden_activation": "gelu", | |
| "hidden_dropout_prob": 0.1, | |
| "hidden_size": 1024, | |
| "initializer_cutoff_factor": 2.0, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2048, | |
| "local_attention": 128, | |
| "local_attention_rope_theta": 10000, | |
| "local_attention_window": 128, | |
| "local_rope_theta": 10000.0, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "mlp_dropout": 0.0, | |
| "model_type": "modernbert", | |
| "norm_bias": false, | |
| "norm_eps": 1e-05, | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 28, | |
| "pad_token_id": 1, | |
| "repad_logits_with_grad": false, | |
| "sep_token_id": 50282, | |
| "sparse_pred_ignore_index": -100, | |
| "sparse_prediction": false, | |
| "transformers_version": "4.56.2", | |
| "type_vocab_size": 2, | |
| "vocab_size": 50368 | |
| } | |