Instructions to use Sky-Kim/com.sky.sentis.audio2lipsync with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- unity-sentis
How to use Sky-Kim/com.sky.sentis.audio2lipsync with unity-sentis:
string modelName = "[Your model name here].sentis"; Model model = ModelLoader.Load(Application.streamingAssetsPath + "/" + modelName); IWorker engine = WorkerFactory.CreateWorker(BackendType.GPUCompute, model); // Please see provided C# file for more details
- Notebooks
- Google Colab
- Kaggle
Download Editor/Audio2LipsyncSerializer.cs from Sky-Kim/com.sky.sentis.audio2lipsync: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/Sky-Kim/com.sky.sentis.audio2lipsync/resolve/main/Editor/Audio2LipsyncSerializer.cs
- Command line
-
hf download hf://Sky-Kim/com.sky.sentis.audio2lipsync/Editor/Audio2LipsyncSerializer.cs
-
curl -L -o Audio2LipsyncSerializer.cs https://huggingface.co/Sky-Kim/com.sky.sentis.audio2lipsync/resolve/main/Editor/Audio2LipsyncSerializer.cs
1.51 kB
| using System.IO; | |
| using Unity.InferenceEngine; | |
| using UnityEditor; | |
| using UnityEngine; | |
| namespace Audio2Lipsync.Editor | |
| { | |
| /// <summary> | |
| /// Turns an imported ONNX (e.g. a re-export from Tools~/export_onnx.py) into a .sentis. Put the | |
| /// result in StreamingAssets/Audio2Lipsync/ to use it instead of the packaged model. | |
| /// </summary> | |
| public static class Audio2LipsyncSerializer | |
| { | |
| /// <param name="quantization">null = keep fp32 weights (what the package ships).</param> | |
| public static void Serialize(ModelAsset onnx, string outPath, QuantizationType? quantization = null) | |
| { | |
| var model = ModelLoader.Load(onnx); | |
| if (quantization.HasValue) ModelQuantizer.QuantizeWeights(quantization.Value, ref model); | |
| Directory.CreateDirectory(Path.GetDirectoryName(outPath)); | |
| ModelWriter.Save(outPath, model); // reload from disk before running a quantized model | |
| Debug.Log($"[Audio2Lipsync] wrote {outPath} ({new FileInfo(outPath).Length / 1e6:F0} MB)"); | |
| } | |
| [] | |
| static void SerializeSelected() | |
| { | |
| Serialize((ModelAsset)Selection.activeObject, Audio2LipsyncModel.StreamingAssetsPath); | |
| AssetDatabase.Refresh(); | |
| } | |
| [] | |
| static bool SerializeSelectedValidate() => Selection.activeObject is ModelAsset; | |
| } | |
| } | |