sentence-transformers safetensors mpnet sentence-similarity feature-extraction generated_from_trainer dataset_size:3494 loss:MultipleNegativesRankingLoss en dataset:glaiveai/godot_4_docs arxiv:1908.10084 arxiv:1705.00652 base_model:sentence-transformers/multi-qa-mpnet-base-dot-v1 base_model:finetune:sentence-transformers/multi-qa-mpnet-base-dot-v1 autotrain_compatible endpoints_compatible region:us
---
base_model: sentence-transformers/multi-qa-mpnet-base-dot-v1
datasets:
- glaiveai/godot_4_docs
language:
- en
library_name: sentence-transformers
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:3494
- loss:MultipleNegativesRankingLoss
widget:
- source_sentence: How can you create a SpinBox in Godot, disable its context menu,
    and set its text alignment to the right using GDScript and C#?
  sentences:
  - If you're just starting with Godot Engine for game development, a great initial
    step is to visit the "Getting Started" section of the Godot documentation, which
    begins with the "Step by step" tutorial tailored for new users. This section will
    provide you with all the necessary information to start making games using Godot.
    For those who prefer video tutorials over text, the "Tutorials and Resources"
    page lists video tutorials contributed by the community, which can serve as an
    excellent supplement to your learning. Additionally, if you encounter any issues
    or need further assistance with your projects, the "Community" section points
    to various channels for help, such as the Godot Discord community (https://discord.gg/4JBkykG)
    and Forum (https://forum.godotengine.org/), where you can seek guidance and support
    from the wider Godot community.
  - 'GDScript:

    ```gdscript

    var spin_box = SpinBox.new()

    add_child(spin_box)

    var line_edit = spin_box.get_line_edit()

    line_edit.context_menu_enabled = false

    spin_box.horizontal_alignment = LineEdit.HORIZONTAL_ALIGNMENT_RIGHT

    ```

    C#:

    ```csharp

    var spinBox = new SpinBox();

    AddChild(spinBox);

    var lineEdit = spinBox.GetLineEdit();

    lineEdit.ContextMenuEnabled = false;

    spinBox.AlignHorizontal = LineEdit.HorizontalAlignEnum.Right;

    ```

    This code demonstrates how to instantiate a SpinBox, disable the context menu
    of its underlying LineEdit, and align the text to the right.'
  - 'To determine the longest and shortest axes of an AABB, you can use the `get_longest_axis`,
    `get_shortest_axis`, and their respective size and index methods. Here''s an example
    in GDScript for finding the longest axis and its size:

    ```gdscript

    var box = AABB(Vector3(0, 0, 0), Vector3(2, 4, 8))

    print(box.get_longest_axis())       # Prints (0, 0, 1)

    print(box.get_longest_axis_size())  # Prints 8

    ```

    For the shortest axis in C#:

    ```csharp

    var box = new Aabb(new Vector3(0, 0, 0), new Vector3(2, 4, 8));

    GD.Print(box.GetShortestAxis());      // Prints (1, 0, 0)

    GD.Print(box.GetShortestAxisSize());  // Prints 2

    ```

    These methods allow you to identify the primary dimensions of an AABB and their
    magnitudes, useful for spatial calculations and optimizations.'
- source_sentence: Can you explain how to toggle between inverse and transpose operations
    on a Transform3D matrix using VisualShaderNodeTransformFunc in a visual shader
    setup?
  sentences:
  - 'To replace an InstancePlaceholder with its intended scene at runtime and ensure
    the newly created node is correctly positioned relative to its parent, you can
    use the `create_instance` method. This method loads the node that the InstancePlaceholder
    is a stand-in for, placing the new node as a sibling above the InstancePlaceholder
    in the scene tree. After calling `create_instance`, the placeholder is typically
    removed or otherwise dealt with to complete the replacement. Here''s an example
    code snippet:

    ```gdscript

    # Assuming `placeholder` is your InstancePlaceholder node.

    var new_node = placeholder.create_instance(true)

    # Optionally, if you need to replace the placeholder with a specific scene other
    than the default:

    # var custom_scene = preload("res://path/to/your/scene.tscn")

    # var new_node = placeholder.create_instance(true, custom_scene)

    # Now `new_node` is positioned correctly relative to its original parent, as intended.

    ```

    This ensures that the newly created node will transform children relatively to
    their parent again, correcting any positioning issues caused by the placeholder
    not having a transform.


    Q: How can you safely call `get_instance_path` from a thread in Godot 4.3?'
  - "To toggle between inverse and transpose operations on a Transform3D matrix using\
    \ VisualShaderNodeTransformFunc in a visual shader, you would typically have some\
    \ logic to update the `function` property of your VisualShaderNodeTransformFunc\
    \ instance based on user input or other conditions. Here's an example of how you\
    \ might set this up in GDScript:\n\n```gdscript\n# Assuming `visual_shader` is\
    \ your VisualShader instance\n# and `transform_func_node_id` is the ID of the\
    \ VisualShaderNodeTransformFunc node within that shader\nvar transform_func =\
    \ visual_shader.get_node(transform_func_node_id)\n\nfunc toggle_transformation(is_inverse):\n\
    \    if is_inverse:\n        transform_func.set_function(VisualShaderNodeTransformFunc.FUNC_INVERSE)\n\
    \    else:\n        transform_func.set_function(VisualShaderNodeTransformFunc.FUNC_TRANSPOSE)\n\
    ```\n\nIn this example, `toggle_transformation` is a function that takes a boolean\
    \ argument `is_inverse`. If `is_inverse` is true, it sets the function of the\
    \ VisualShaderNodeTransformFunc to perform an inverse operation on the Transform3D\
    \ matrix. If false, it sets the function to perform a transpose operation. This\
    \ allows you to dynamically change the operation being performed by the VisualShaderNodeTransformFunc\
    \ node based on runtime conditions or user input."
  - "To compress and then decompress a `PackedByteArray` in Godot 4.3 while ensuring\
    \ the original data is preserved, you can use the `compress` and `decompress`\
    \ methods respectively. Here's how you can do it in GDScript:\n```gdscript\nvar\
    \ original_data = PackedByteArray([1, 2, 3, 4, 5])\n# Compress the data\nvar compressed_data\
    \ = original_data.compress()\n# Decompressed the data. You need to know the buffer\
    \ size of the original data.\nvar decompressed_data = compressed_data.decompress(original_data.size())\n\
    \n# Comparing to ensure the original data is preserved\nif original_data == decompressed_data:\n\
    \    print(\"Compression and decompression successful, original data preserved.\"\
    )\nelse:\n    print(\"Data mismatch, original data not preserved.\")\n```\nIn\
    \ this example, `compress()` is used without arguments, which means it uses the\
    \ default compression mode. For `decompress()`, the original uncompressed data\
    \ size (`original_data.size()`) is passed as the `buffer_size` argument to ensure\
    \ the decompressed data matches the original data size. This is a simple demonstration,\
    \ and the actual compression mode and buffer sizes might vary depending on your\
    \ specific use case."
- source_sentence: What is the inheritance hierarchy of the AudioStreamPlaybackInteractive
    class in Godot 4.3, and how can its methods be utilized in a game for dynamic
    audio management?
  sentences:
  - "The AudioStreamPlaybackInteractive class inherits from AudioStreamPlayback, which\
    \ in turn inherits from RefCounted, and finally, Object is at the base of this\
    \ hierarchy. This inheritance chain is significant as it places AudioStreamPlaybackInteractive\
    \ within Godot's object system, enabling it to be reference-counted and to participate\
    \ in the engine's memory management and object messaging systems.\n\nTo utilize\
    \ its methods for dynamic audio management in a game, you could dynamically switch\
    \ audio clips during gameplay to reflect changes in the game's state, environment,\
    \ or player actions. Here's a more complex example demonstrating how you might\
    \ implement this:\n\n```gdscript\n# Assuming this script is attached to a Node\
    \ that has an AudioStreamPlayer as a child,\n# and the AudioStreamPlayer has an\
    \ AudioStreamPlaybackInteractive as its stream.\n\n# Reference to the AudioStreamPlayer\
    \ node\nvar audio_player = $AudioStreamPlayer\n\nfunc switch_audio_clip_by_index(index:\
    \ int):\n    var playback = audio_player.get_stream_playback()\n    if playback\
    \ is AudioStreamPlaybackInteractive:\n        playback.switch_to_clip(index)\n\
    \    else:\n        print(\"The current playback is not interactive.\")\n\nfunc\
    \ switch_audio_clip_by_name(name: StringName):\n    var playback = audio_player.get_stream_playback()\n\
    \    if playback is AudioStreamPlaybackInteractive:\n        playback.switch_to_clip_by_name(name)\n\
    \    else:\n        print(\"The current playback is not interactive.\")\n\n# Example\
    \ usage\nfunc _ready():\n    switch_audio_clip_by_index(0) # Switches to the first\
    \ clip on ready\n    # Could be used in response to game events, like:\n    #\
    \ switch_audio_clip_by_name(\"VictoryTheme\")\n```\n\nIn this example, the `switch_audio_clip_by_index`\
    \ and `switch_audio_clip_by_name` methods demonstrate how to interact with an\
    \ `AudioStreamPlaybackInteractive` through an `AudioStreamPlayer`. This approach\
    \ allows for dynamic audio management by switching the audio clips based on game\
    \ logic, such as changing the background music to reflect the game's current state\
    \ or responding to specific player actions."
  - "To implement multi-language support in a Godot application that includes English,\
    \ both Simplified and Traditional Chinese, and Canadian French, you first need\
    \ to identify the locale codes for these languages. They are `en` for English,\
    \ `zh_Hans` for Simplified Chinese, `zh_Hant` for Traditional Chinese, and `fr_CA`\
    \ for Canadian French. You can then use Godot's `OS.set_locale()` function to\
    \ switch between these languages based on user selection or application settings.\n\
    \nHere's an example of how you might implement a simple language selection function\
    \ in a Godot script:\n\n```gdscript\nfunc set_language(language : String):\n \
    \   match language:\n        \"English\":\n            OS.set_locale(\"en\")\n\
    \        \"Simplified Chinese\":\n            OS.set_locale(\"zh_Hans\")\n   \
    \     \"Traditional Chinese\":\n            OS.set_locale(\"zh_Hant\")\n     \
    \   \"Canadian French\":\n            OS.set_locale(\"fr_CA\")\n        _:\n \
    \           print(\"Language not supported: \" + language)\n\n# Example usage\n\
    set_language(\"English\")\nset_language(\"Simplified Chinese\")\nset_language(\"\
    Traditional Chinese\")\nset_language(\"Canadian French\")\n```\n\nThis script\
    \ defines a function `set_language()` that takes a `language` string as an argument.\
    \ Inside the function, a `match` statement is used to set the application's locale\
    \ to the corresponding locale code using `OS.set_locale()` based on the provided\
    \ `language` string. If a language is not supported, it prints a message indicating\
    \ so. This approach allows for easy extension to include more languages by adding\
    \ additional cases to the `match` statement.\n\nRemember to ensure that your application\
    \ properly loads and displays text resources based on the current locale to fully\
    \ support internationalization. This might involve loading different translation\
    \ files, updating UI elements to reflect the selected language, and possibly handling\
    \ text layout differences for languages with unique scripts."
  - 'To create a Sky resource in Godot with a PanoramaSkyMaterial, and set its radiance_size
    to RADIANCE_SIZE_512 while ensuring the process_mode is set to PROCESS_MODE_REALTIME,
    you can follow these steps:


    1. Create a new Sky resource and assign it to a variable.

    2. Create a PanoramaSkyMaterial or load one if you already have it.

    3. Set the PanoramaSkyMaterial as the sky_material of the Sky resource.

    4. Set the radiance_size of the Sky resource to RADIANCE_SIZE_512.

    5. Set the process_mode of the Sky resource to PROCESS_MODE_REALTIME.


    Here''s an example of how you might write this in GDScript:


    ```gdscript

    # Create the Sky resource

    var sky = Sky.new()


    # Assuming you have a PanoramaSkyMaterial loaded or created

    var panorama_sky_material = PanoramaSkyMaterial.new()

    # Configure your PanoramaSkyMaterial here (e.g., setting the panorama texture)


    # Set the PanoramaSkyMaterial as the sky''s material

    sky.set_material(panorama_sky_material)


    # Set the radiance size to 512x512 pixels

    sky.set_radiance_size(Sky.RADIANCE_SIZE_512)


    # Set the process mode to real-time

    sky.set_process_mode(Sky.PROCESS_MODE_REALTIME)


    # Assign the sky to an Environment or WorldEnvironment node if needed

    # For example, if you have a WorldEnvironment node in your scene:

    var world_environment = get_node("WorldEnvironment")

    world_environment.environment.sky = sky

    ```


    **Note:** When setting the process_mode to PROCESS_MODE_REALTIME, and the radiance
    size to RADIANCE_SIZE_512, it''s important to remember that real-time processing
    with such a high radiance size may have performance implications on lower-end
    hardware. Always test your game on target hardware to ensure performance is acceptable.'
- source_sentence: How would you configure a Range to use exponential representation
    for its values and also set a custom step value?
  sentences:
  - 'To configure a Range to use exponential representation for its values, you must
    set the `exp_edit` property to `true`. Additionally, to set a custom step value,
    you would assign a new value to the `step` property. Here''s how you can do both
    in GDScript:

    ```gdscript

    var range_control = Range.new()

    range_control.exp_edit = true  # Enables exponential representation

    range_control.step = 0.05  # Sets a custom step value

    ```

    This setup is particularly useful when dealing with a range of values where an
    exponential scale provides a better user experience, such as audio volume or zoom
    levels.'
  - 'The `density` property of a FogMaterial in Godot 4.3 controls the opacity of
    the FogVolume it is applied to; denser fog appears more opaque. The density is
    a float value, with denser objects potentially suffering from under-sampling artifacts
    that resemble stripes. Interestingly, negative values for density can be used
    to subtract fog from other FogVolumes or the global volumetric fog, providing
    a means to create dynamic effects like clearings or tunnels within the fog.


    However, it''s important to note that due to limited precision, density values
    between `-0.001` and `0.001` (exclusive) are treated as `0.0`, effectively making
    the fog invisible. This restriction doesn''t apply to the global volumetric fog
    density set in the Environment.


    To adjust the density of a FogVolume using a FogMaterial, you can use the `set_density()`
    method. Here''s an example in GDScript:


    ```gdscript

    # Assuming `fog_material` is an instance of FogMaterial.

    fog_material.set_density(1.5) # Makes the fog denser and more opaque.

    # To create a subtractive effect, you could use:

    fog_material.set_density(-0.5)

    ```


    These adjustments allow for fine-tuning the visual impact of fog in a scene, enabling
    both aesthetic and gameplay-related effects.'
  - 'For optimizing the performance when dealing with thousands of instances that
    need constant processing while retaining a certain level of control, it is recommended
    to use servers directly as per the Godot documentation. This approach leverages
    lower-level APIs for more efficient management of resources. However, when the
    object count escalates to hundreds of thousands or millions, this method becomes
    inefficient. In such scenarios, the next step in optimization involves using MultiMeshes.
    A MultiMesh is a single draw primitive capable of drawing up to millions of objects
    efficiently by utilizing GPU hardware, thus significantly reducing the processing
    and rendering load. This method is especially effective unless individual instance
    culling is required, for which MultiMeshes do not provide a solution due to their
    all-or-none visibility nature.


    Q: How can you manage the visibility of instances in a MultiMesh, and what is
    a practical example of using MultiMesh in Godot for managing thousands of instances?'
- source_sentence: How do you manage scene transitions in Godot by switching from
    the current scene to another using a file path, and what are the possible outcomes
    of this operation?
  sentences:
  - "In Godot, Semaphores can be used to make a thread work on demand, suspending\
    \ it when it's not processing any data and waking it up when there is data to\
    \ process. The steps to implement this are:\n1. Declare a Semaphore along with\
    \ a Mutex for data protection and a variable to control the thread exit.\n2. In\
    \ the thread function, use `semaphore.wait()` to suspend the thread until it's\
    \ signaled to work.\n3. Use `semaphore.post()` in the main thread or any thread\
    \ that provides data to signal the suspended thread to start processing.\n4. Use\
    \ a Mutex to safely check and modify shared data or control variables.\n\nHere\
    \ is an example demonstrating the use of Semaphores for on-demand thread work:\n\
    \n```gdscript\nvar counter := 0\nvar mutex: Mutex\nvar semaphore: Semaphore\n\
    var thread: Thread\nvar exit_thread := false\n\nfunc _ready():\n    mutex = Mutex.new()\n\
    \    semaphore = Semaphore.new()\n    thread = Thread.new()\n    thread.start(_thread_function)\n\
    \nfunc _thread_function():\n    while true:\n        semaphore.wait() # Suspend\
    \ until signaled.\n\n        mutex.lock()\n        if exit_thread:\n         \
    \   mutex.unlock()\n            break\n        counter += 1\n        mutex.unlock()\n\
    \nfunc increment_counter():\n    semaphore.post() # Signal the thread to work.\n\
    \nfunc _exit_tree():\n    mutex.lock()\n    exit_thread = true\n    mutex.unlock()\n\
    \    semaphore.post() # Ensure the thread exits the loop.\n    thread.wait_to_finish()\n\
    \    print(\"Counter is: \", counter)\n```\n\nIn this example, a thread increments\
    \ a counter each time it's signaled by the main thread calling `increment_counter()`,\
    \ which posts to the semaphore. The thread suspends itself by waiting on the semaphore\
    \ if there's no work, ensuring it only runs on demand."
  - "To manage scene transitions in Godot by switching from the current scene to another\
    \ using a file path, you use the `change_scene_to_file` method of the `SceneTree`.\
    \ This method takes the path of the scene file you want to switch to. It first\
    \ attempts to load the scene from the given path into a `PackedScene`, then tries\
    \ to instantiate it and set it as the current scene. Here's how you can perform\
    \ the operation and handle the possible outcomes:\n\n```gdscript\nfunc switch_scene(scene_path:\
    \ String):\n    var error = get_tree().change_scene_to_file(scene_path)\n    match\
    \ error:\n        OK:\n            print(\"Scene switched successfully.\")\n \
    \       ERR_CANT_OPEN:\n            print(\"Failed to load the scene. Check if\
    \ the path is correct.\")\n        ERR_CANT_CREATE:\n            print(\"Failed\
    \ to instantiate the scene.\")\n```\n\nThe possible outcomes of this operation\
    \ are:\n\n- `OK`: The scene was successfully changed.\n- `ERR_CANT_OPEN`: The\
    \ scene file could not be loaded, which often means the path is incorrect or the\
    \ file is missing.\n- `ERR_CANT_CREATE`: The loaded `PackedScene` could not be\
    \ instantiated, which could indicate a problem with the scene setup.\n\nHandling\
    \ these outcomes is important for debugging and ensuring that your game can gracefully\
    \ handle errors related to scene transitions."
  - 'To create a `VisualShaderNodeFloatOp` in Godot for summing two numbers, you first
    need to instantiate the node and then set its operator to `OP_ADD`. After creating
    the node, you have to add it to your visual shader graph and connect the inputs
    `a` and `b` to the appropriate sources. Here''s an example of how you can do this
    in GDScript:


    ```gdscript

    # Assuming you have a VisualShader instance named ''visual_shader''


    # Create the VisualShaderNodeFloatOp

    var float_op = VisualShaderNodeFloatOp.new()


    # Set the operation to OP_ADD (sum two numbers)

    float_op.set_operator(VisualShaderNodeFloatOp.OP_ADD)


    # Add the VisualShaderNodeFloatOp to the visual shader

    var unique_id = visual_shader.add_node(VisualShader.TYPE_FRAGMENT, float_op, Vector2(0,
    0))


    # Now, you would connect the inputs ''a'' and ''b'' from other nodes

    # For example, assuming you have two constant nodes with IDs const_node_a_id and
    const_node_b_id

    visual_shader.node_connect(const_node_a_id, 0, unique_id, 0) # Connect output
    of const_node_a to input ''a'' of float_op

    visual_shader.node_connect(const_node_b_id, 0, unique_id, 1) # Connect output
    of const_node_b to input ''b'' of float_op

    ```

    This code demonstrates how to create a `VisualShaderNodeFloatOp` for adding two
    numbers, setting its operation to addition, and connecting it within a visual
    shader graph.'
---

# SentenceTransformer based on sentence-transformers/multi-qa-mpnet-base-dot-v1

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1) on the [train](https://huggingface.co/datasets/glaiveai/godot_4_docs) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

## Model Details

### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [sentence-transformers/multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1) <!-- at revision 4633e80e17ea975bc090c97b049da26062b054d3 -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Dot Product
- **Training Dataset:**
    - [train](https://huggingface.co/datasets/glaiveai/godot_4_docs)
- **Language:** en
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### Full Model Architecture

```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: MPNetModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```

## Usage

### Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("Faith1712/multi-qa-mpnet-glaive-godotdocs-dot")
# Run inference
sentences = [
    'How do you manage scene transitions in Godot by switching from the current scene to another using a file path, and what are the possible outcomes of this operation?',
    'To manage scene transitions in Godot by switching from the current scene to another using a file path, you use the `change_scene_to_file` method of the `SceneTree`. This method takes the path of the scene file you want to switch to. It first attempts to load the scene from the given path into a `PackedScene`, then tries to instantiate it and set it as the current scene. Here\'s how you can perform the operation and handle the possible outcomes:\n\n```gdscript\nfunc switch_scene(scene_path: String):\n    var error = get_tree().change_scene_to_file(scene_path)\n    match error:\n        OK:\n            print("Scene switched successfully.")\n        ERR_CANT_OPEN:\n            print("Failed to load the scene. Check if the path is correct.")\n        ERR_CANT_CREATE:\n            print("Failed to instantiate the scene.")\n```\n\nThe possible outcomes of this operation are:\n\n- `OK`: The scene was successfully changed.\n- `ERR_CANT_OPEN`: The scene file could not be loaded, which often means the path is incorrect or the file is missing.\n- `ERR_CANT_CREATE`: The loaded `PackedScene` could not be instantiated, which could indicate a problem with the scene setup.\n\nHandling these outcomes is important for debugging and ensuring that your game can gracefully handle errors related to scene transitions.',
    'In Godot, Semaphores can be used to make a thread work on demand, suspending it when it\'s not processing any data and waking it up when there is data to process. The steps to implement this are:\n1. Declare a Semaphore along with a Mutex for data protection and a variable to control the thread exit.\n2. In the thread function, use `semaphore.wait()` to suspend the thread until it\'s signaled to work.\n3. Use `semaphore.post()` in the main thread or any thread that provides data to signal the suspended thread to start processing.\n4. Use a Mutex to safely check and modify shared data or control variables.\n\nHere is an example demonstrating the use of Semaphores for on-demand thread work:\n\n```gdscript\nvar counter := 0\nvar mutex: Mutex\nvar semaphore: Semaphore\nvar thread: Thread\nvar exit_thread := false\n\nfunc _ready():\n    mutex = Mutex.new()\n    semaphore = Semaphore.new()\n    thread = Thread.new()\n    thread.start(_thread_function)\n\nfunc _thread_function():\n    while true:\n        semaphore.wait() # Suspend until signaled.\n\n        mutex.lock()\n        if exit_thread:\n            mutex.unlock()\n            break\n        counter += 1\n        mutex.unlock()\n\nfunc increment_counter():\n    semaphore.post() # Signal the thread to work.\n\nfunc _exit_tree():\n    mutex.lock()\n    exit_thread = true\n    mutex.unlock()\n    semaphore.post() # Ensure the thread exits the loop.\n    thread.wait_to_finish()\n    print("Counter is: ", counter)\n```\n\nIn this example, a thread increments a counter each time it\'s signaled by the main thread calling `increment_counter()`, which posts to the semaphore. The thread suspends itself by waiting on the semaphore if there\'s no work, ensuring it only runs on demand.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Dataset

#### train

* Dataset: [train](https://huggingface.co/datasets/glaiveai/godot_4_docs) at [9d62dbd](https://huggingface.co/datasets/glaiveai/godot_4_docs/tree/9d62dbd81c4d61be1dc4592ca855f0c7d78c9712)
* Size: 3,494 training samples
* Columns: <code>prompt</code> and <code>response</code>
* Approximate statistics based on the first 1000 samples:
  |         | prompt                                                                              | response                                                                             |
  |:--------|:------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
  | type    | string                                                                              | string                                                                               |
  | details | <ul><li>min: 15 tokens</li><li>mean: 33.97 tokens</li><li>max: 125 tokens</li></ul> | <ul><li>min: 60 tokens</li><li>mean: 326.79 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
  | prompt                                                                                                                                                                     | response                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
  |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | <code>How can one import animations from a 3D scene using Godot's ResourceImporterScene and specify the desired FPS for the animation?</code>                              | <code>To import animations from a 3D scene using Godot's ResourceImporterScene and specify the desired frames per second (FPS) for the animation, you would need to set the `animation/import` property to `true` and adjust the `animation/fps` property to your desired value. For instance, if you want to bake the animation curves at 60 FPS, you would configure these properties as follows:<br><br>```gdscript<br>var importer = ResourceImporterScene.new()<br>importer.set_option("animation/import", true)<br>importer.set_option("animation/fps", 60)<br>```<br><br>This code snippet creates a new instance of ResourceImporterScene, enables animation import, and sets the animation FPS to 60, ensuring that the animation is baked with linear interpolation at the specified frame rate.</code>                                                                                                                                                                                                                                                                   |
  | <code>Can you explain how to add a new blend point to an AnimationNodeBlendSpace1D and describe the role of the `at_index` parameter in this process?</code>               | <code>To add a new blend point to an AnimationNodeBlendSpace1D, you use the `add_blend_point` method. This method requires specifying the node (of type AnimationRootNode) you wish to add as a blend point, its position on the virtual axis (a float value), and optionally, the index where you want to insert this new blend point. The `at_index` parameter is used to specify this location; if you leave it at its default value of `-1`, the new blend point will be added to the end of the blend points array. Here's how you might add a blend point:<br><br>```gdscript<br>var blend_space = AnimationNodeBlendSpace1D.new()<br>var animation_node = AnimationNode.new() # Assume this is properly set up<br>blend_space.add_blend_point(animation_node, 0.5) # Adds at the end<br>blend_space.add_blend_point(animation_node, -0.5, 0) # Inserts at the start<br>```<br><br>This process allows you to organize and manage how different animations are blended based on a 1D axis, with the position determining where along the axis the blend point falls...</code> |
  | <code>How can you use PhysicsTestMotionParameters2D to improve floor detection in a CharacterBody2D, and what are the default settings for recovering as collision?</code> | <code>To use `PhysicsTestMotionParameters2D` for improving floor detection in a `CharacterBody2D`, you should enable the `recovery_as_collision` property. This property, when set to `true`, ensures that any movement to resolve overlaps (depenetration) during the recovery phase of collision detection is reported as a collision. This feature is particularly useful for character controllers that rely on precise floor detection, such as when implementing snapping to the ground. By default, `recovery_as_collision` is set to `false`, meaning only collisions resulting directly from the motion are reported. To enable it, you can use the following code:<br><br>```gdscript<br>var params = PhysicsTestMotionParameters2D.new()<br>params.set_recovery_as_collision_enabled(true)<br>```<br><br>By enabling this setting, `CharacterBody2D` can more accurately detect floors, especially in scenarios involving floor snapping or when the character is standing on moving platforms.</code>                                                                   |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
  ```json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }
  ```

### Training Hyperparameters
#### Non-Default Hyperparameters

- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `learning_rate`: 2e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates

#### All Hyperparameters
<details><summary>Click to expand</summary>

- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: no
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 2e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 1
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `use_ipex`: False
- `bf16`: False
- `fp16`: True
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch
- `optim_args`: None
- `adafactor`: False
- `group_by_length`: False
- `length_column_name`: length
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `use_legacy_prediction_loop`: False
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: None
- `hub_always_push`: False
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `include_for_metrics`: []
- `eval_do_concat_batches`: True
- `fp16_backend`: auto
- `push_to_hub_model_id`: None
- `push_to_hub_organization`: None
- `mp_parameters`: 
- `auto_find_batch_size`: False
- `full_determinism`: False
- `torchdynamo`: None
- `ray_scope`: last
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `dispatch_batches`: None
- `split_batches`: None
- `include_tokens_per_second`: False
- `include_num_input_tokens_seen`: False
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `use_liger_kernel`: False
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: False
- `prompts`: None
- `batch_sampler`: no_duplicates
- `multi_dataset_batch_sampler`: proportional

</details>

### Training Logs
| Epoch  | Step | Training Loss |
|:------:|:----:|:-------------:|
| 0.4566 | 100  | 0.0014        |
| 0.9132 | 200  | 0.0007        |


### Framework Versions
- Python: 3.12.3
- Sentence Transformers: 3.3.1
- Transformers: 4.47.1
- PyTorch: 2.5.1+cu124
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0

## Citation

### BibTeX

#### Sentence Transformers
```bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
```

#### MultipleNegativesRankingLoss
```bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->