File size: 1,352 Bytes
ab1e40d
11eee88
dea59e5
2e4f09d
ab1e40d
11eee88
522203e
ade37fe
11eee88
24438fc
11eee88
 
 
 
522203e
11eee88
 
 
 
 
24438fc
47d883e
24438fc
df57120
 
 
 
 
 
 
 
 
 
 
 
11eee88
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
license: apache-2.0
library_name: unity-sentis
pipeline_tag: sentence-similarity
---

# Mini LM Sentis Similarity validated for Unity Sentis (Version 1.4.0-pre.2*)
*Version 1.3.0 Sentis files are not compatible with Sentis 1.4.0 and need to be recreated/downloaded

This is the [Mini LM v6 model](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) in the Sentis format to run on Unity 2023. It is a sentence similarity model that compares different sentences and gives a score depending on how similar they are.

## How to Use

* Create a new scene in Unity 2023
* Install com.unity.sentis from the package manager
* Add the MiniLMv6.cs file to the Main Camera
* Add vocab.txt and MiniLMv6.sentis to the Assets/StreamingAssets folder
* Change the string1 and string2 variables to the desired strings
* Press play, the results will show in the Console

## Project Demonstration
Thomas, a member of the Hugging Face team, also a good [tutorial](https://thomassimonini.substack.com/p/create-an-ai-robot-npc-using-hugging) of using this model in a mini-game made.

# Example Inputs
```
string1 = "That is a happy person"

string2 = "That is a happy dog"
```

# Example Outputs
```
Similarity Score: 0.6945773
```

## Unity Sentis
Sentis is the inference engine for Unity. More can be found about it [here](https://unity.com/products/sentis)