
# Tiny Stories Model in Unity Sentis Format
This is the [Tiny Stories model](https://huggingface.co/roneneldan/TinyStories-33M) checked to run on Unity 2023. Tiny Stories is a Large Language Model that was trained on children's stories and can create stories based on the first couple of sentences.


## How to Use
* Create a new scene in Unity 2023
* Install `com.unity.sentis` and `com.unity.nuget.newtonsoft-json` packages
* Add the RunTinyStories.cs file to the Main Camera
* Put `tinystories.sentis`, `vocab.json` and `merges.txt` in the Assets/StreamingAssets folder
* Adjust some of the variables such as the `outputText` string to set the prompt
* Press run
* The output will appear in the console window

## Example Input
```
One day an alien came down from Mars. It saw a chicken
```
## Example Output
```
One day an alien came down from Mars. It saw a chicken and said, "Hello, little chicken. What are you doing here?"

The chicken replied, "I'm looking for a place to stay. I'm very tired."

The alien said, "You can stay here. I have a nice place for you. It's very comfortable."

The chicken was so happy. She thanked the alien and said, "Thank you. I'm very comfortable here."

The alien smiled and said, "You're welcome
```

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

## Disclaimer
The model was trained on children's stories so very unlikely to produce undesirable text. As an extra precaution, we removed a few tokens from vocab.json that might not be suitable for younger audiences. The original json can be found on the Tiny Stories original page.
{"license": "mit", "library_name": "unity-sentis", "pipeline_tag": "text-generation"}
unity-sentis text-generation license:mit region:us