File size: 1,715 Bytes
1966dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439d047
 
 
1966dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
---
library_name: sentis
tags:
- unity-sentis
- onnx
- smollm2
- causal-lm
license: apache-2.0
language:
- en
base_model: HuggingFaceTB/SmolLM2-135M-Instruct
pipeline_tag: text-generation
---

# SmolLM2-135M-Instruct for Unity Sentis

This repository contains optimized versions of the [SmolLM2-135M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) model, specifically formatted for use in **Unity Sentis**.

SmolLM2-135M is an ultra-compact model that excels at on-device tasks like text rewriting, summarization, and simple NPC dialogue while maintaining an exceptionally small memory footprint.

## Available Versions

| File Name | Format | Precision | Size | Best For |
| :--- | :--- | :--- | :--- | :--- |
| `model.onnx` | ONNX | FP32 | ~530MB | High-fidelity source / Desktop |
| `model_FP16.sentis` | Sentis | FP16 | ~320MB | Balanced Performance / Mobile |
| `model_Uint8.sentis` | Sentis | Uint8 | ~160MB | Maximum Performance / WebGL / Low-end Mobile |

## How to use in Unity

1. **Install Sentis**: Use the Unity Package Manager to install `com.unity.sentis` (2.1.0+ recommended).
2. **Download Model**: Choose the `.sentis` file based on your target platform's memory constraints.
3. **Import**: Drag the `.sentis` file and the `tokenizer.json` into your Unity project.

### Basic C# Loading Snippet
```csharp
using Unity.Sentis;
using UnityEngine;

public class TinyLLM : MonoBehaviour {
    public ModelAsset modelAsset;
    private IWorker engine;

    void Start() {
        Model runtimeModel = ModelLoader.Load(modelAsset);
        // GPUCompute is recommended for mobile performance
        engine = WorkerFactory.CreateWorker(BackendType.GPUCompute, runtimeModel);
    }
}