Views
No views yet
SentenceTransformer(
(0): StaticEmbedding({})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 "Find tool: If I roll 3 dice, what's the probability of getting a sum of 10? Additionally, if I invested $5000 and it grew to $7500 over 3 years, what was the CAGR?",
8 'Tools: [{"name": "cagr", "description": "Calculates the Compound Annual Growth Rate (CAGR) of an investment.", "parameters": {"start_value": {"description": "The initial value of the investment.", "type": "float"}, "end_value": {"description": "The final value of the investment.", "type": "float"}, "years": {"description": "The number of years between the initial and final values.", "type": "int"}}}, {"name": "binomial_probability", "description": "Calculates the probability of getting exactly k successes in n independent trials,", "parameters": {"n": {"description": "The total number of trials.", "type": "int"}, "k": {"description": "The number of successes.", "type": "int"}, "p": {"description": "The probability of success in each trial.", "type": "float"}}}, {"name": "dice_roll_probability", "\nCalled: [{"name": "dice_roll_probability", "arguments": {"target_sum": 10, "num_dice": 3}}, {"name": "cagr", "arguments": {"start_value": 5000, "end_value": 7500, "years": 3}}]',
9 "Review: <think>\nOkay, let's see the problem here. So we have a pyramid with N steps, and the bottom step (step N) has a permutation of numbers from 1 to 2N-1. The rule is that each block above is the median of the three blocks directly below it. And we need to find the number in the top block (step 1). \n\nHmm, the sample input for N=4 gives output 4, and for N=2 it's 2. Wait a second, those outputs are exactly equal to N. So maybe the answer is always N? But why?\n\nLet me think. Let's consider the process. The top block's value depends on the medians as we go down. But since every step's value is the me\n```python\nn = int(input())\na = list(map(int, input().split()))\nprint(n)\n```",
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 256]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.7395, 0.0061],
19# [0.7395, 1.0000, 0.0494],
20# [0.0061, 0.0494, 1.0000]])anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details |
|
|
| anchor | positive |
|---|---|
Solve: Consider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex u is called a child of vertex v and vertex v is called a parent of vertex u if there exists a directed edge from v to u. A vertex is called a leaf if it doesn't have children and has a parent.[object Object][object Object]Let's call a rooted tree a spruce if its every non-leaf vertex has at least 3 leaf children. You are given a rooted tree, check whether it's a spruce.[object Object][object Object]The definition of a rooted tree can be found [object Object].[object Object]Input[object Object][object Object]The first line contains one integer n — the numb | [object Object] |
Solve: There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors.[object Object][object Object]Find the number of the possible ways to paint the balls.[object Object][object Object]Constraints[object Object][object Object]* 1≦N≦1000[object Object]* 2≦K≦1000[object Object]* The correct answer is at most 2^{31}-1.[object Object]Input[object Object][object Object]The input is given from Standard Input in the following format:[object Object][object Object][object Object]N K[object Object][object Object][object Object]Output[object Object][object Object]Print the number of the possible ways to paint the balls.[object Object][object Object]Examples[object Object][object Object]Input[object Object][object Object]2 2[object Object][object Object][object Object]Output[object Object][object Object]2[object Object][object Object][object Object]Input[object Object][object Object]1 10[object Object][object Object][object Object]Output[object Object][object Object]10 | [object Object] |
Solve: Little Pandey is someone who is lazy, and when he's around his best friend GJ, he becomes super lazy. Pandey thinks that he is a Math-wizard, so he picks up a number S and asks GJ to throw him a challenge around that number. [object Object][object Object]GJ explains Little Pandey a property called nothingness and decides to ask him Q queries based on it.[object Object]In mathematical terms, Nothingness(A, B) is defined as the maximum M that (A%M==0 and B%M==0). (You can read about the Modulus Operator here.)[object Object]In the i-th query GJ says a number Ai and Little Pandey must find Nothingness(S, Ai).[object Object][object Object]But, Pandey is the laziest of all.[object Object]He wo | [object Object] |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details |
|
|
| anchor | positive |
|---|---|
Solve: Shaass thinks a kitchen with all white floor tiles is so boring. His kitchen floor is made of n·m square tiles forming a n × m rectangle. Therefore he's decided to color some of the tiles in black so that the floor looks like a checkerboard, which is no two side-adjacent tiles should have the same color.[object Object][object Object]Shaass wants to use a painter robot to color the tiles. In the beginning the robot is standing in a border tile (xs, ys) facing a diagonal direction (i.e. upper-left, upper-right, down-left or down-right). As the robot walks in the kitchen he paints every tile he passes even if it's painted b | [object Object] |
Find tool: Fetch the dialog strings for users 'user14' and 'user15', who are contributors to an open-source project. | Tools: [{"name": "get_user_dialog_string", "description": "Fetches the dialog string for a given user from the Waifu API.", "parameters": {"user_id": {"description": "A unique identifier for the user.", "type": "str", "default": "sample_user_id"}}}][object Object]Called: [{"name": "get_user_dialog_string", "arguments": {"user_id": "user14"}}, {"name": "get_user_dialog_string", "arguments": {"user_id": "user15"}}] |
Code (python): [object Object] | Review: [object Object] |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 4096num_train_epochs: 5learning_rate: 0.04lr_scheduler_type: cosinewarmup_steps: 0.05disable_tqdm: Trueper_device_eval_batch_size: 4096dataloader_drop_last: Truedataloader_num_workers: 4batch_sampler: no_duplicatesper_device_train_batch_size: 4096num_train_epochs: 5max_steps: -1learning_rate: 0.04lr_scheduler_type: cosinelr_scheduler_kwargs: Nonewarmup_steps: 0.05optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Trueproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 4096prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Truedataloader_num_workers: 4dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}deepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0069 | 1 | 3.1332 |
| 0.0690 | 10 | 3.0859 |
| 0.1379 | 20 | 2.7984 |
| 0.2069 | 30 | 2.4399 |
| 0.2759 | 40 | 2.1068 |
| 0.3448 | 50 | 1.8330 |
| 0.4138 | 60 | 1.6418 |
| 0.4828 | 70 | 1.4892 |
| 0.5517 | 80 | 1.3397 |
| 0.6207 | 90 | 1.2159 |
| 0.6897 | 100 | 1.1323 |
| 0.7586 | 110 | 1.0537 |
| 0.8276 | 120 | 0.9845 |
| 0.8966 | 130 | 0.9245 |
| 0.9655 | 140 | 0.8589 |
| 0.9793 | 142 | - |
| 1.0552 | 150 | 0.7909 |
| 1.1241 | 160 | 0.7432 |
| 1.1931 | 170 | 0.7173 |
| 1.2621 | 180 | 0.6876 |
| 1.3310 | 190 | 0.6648 |
| 1.4 | 200 | 0.6410 |
| 1.4690 | 210 | 0.6102 |
| 1.5379 | 220 | 0.5917 |
| 1.6069 | 230 | 0.5745 |
| 1.6759 | 240 | 0.5561 |
| 1.7448 | 250 | 0.5461 |
| 1.8138 | 260 | 0.5416 |
| 1.8828 | 270 | 0.5205 |
| 1.9517 | 280 | 0.5045 |
| 1.9793 | 284 | - |
| 2.0414 | 290 | 0.4867 |
| 2.1103 | 300 | 0.4625 |
| 2.1793 | 310 | 0.4571 |
| 2.2483 | 320 | 0.4541 |
| 2.3172 | 330 | 0.4423 |
| 2.3862 | 340 | 0.4436 |
| 2.4552 | 350 | 0.4323 |
| 2.5241 | 360 | 0.4263 |
| 2.5931 | 370 | 0.4258 |
| 2.6621 | 380 | 0.4155 |
| 2.7310 | 390 | 0.4083 |
| 2.8 | 400 | 0.4131 |
| 2.8690 | 410 | 0.4059 |
| 2.9379 | 420 | 0.3996 |
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}1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}