Spaces:
Running
Running
How To Create A Space For Your Unity Environment
#1
by
cm107
- opened
Procedure
For anyone else that is trying to do the same thing as me:
- Clone
Unity-WebGL-template-for-Hugging-Face-Spaces . - In your Unity Editor, drag 'Hugging Face WebGL Template.unitypackage' into your Assets folder any import everything.
- Open your player settings (Edit> Project Settings > Player), and under the WebGL tab, under Resolution and Presentation, select the "Hugging Face" template.
- Open your Build Settings, change your platform to WebGL, check Development Build (this might be optional), and then click Build And Run.
- If the build went well, your game should open up in your default browser.
- Create a new huggingface space using the Static SDK.
- Clone your new space to your computer.
cp -r /path/to/build/directory/* /path/to/space/repo/
- Since the *.data files in your Build folder are likely too big, you will need to track them with git lfs.
git lfs install && git lfs track "*.data"
- Commit and push. You might be asked to enter your username and password multiple times for each file that needs to be tracked with lfs.
- Go to your space on huggingface and confirm that the app is working.
Notes
- This should work regardless of whether or not your scene uses ML-Agents.
- If you do happen to use ML-Agents, (I think) the trained weights that you referenced inside of your scene is included in your build's binary.
- If you want to switch between models, you would need to implement that logic in your C# code.
- As for how to use models that were uploaded to huggingface, I have no idea. ThomasSimonini seems to know how to do that, but as far as I know he hasn't published the code that he used to do it.