Skip to content

Commit ff9f8bc

Browse files
committed
Add NSS model training gym LP
1 parent 5525485 commit ff9f8bc

File tree

6 files changed

+277
-0
lines changed

6 files changed

+277
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Install Model Gym and Explore Neural Graphics Examples
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## What is Neural Graphics?
10+
11+
Neural graphics is an intersection of graphics and machine learning. Rather than relying purely on traditional GPU pipelines, neural graphics integrates learned models directly into the rendering stack. The techniques are particularly powerful on mobile devices, where battery life and performance constraints limit traditional compute-heavy rendering approaches. The goal is to deliver high visual fidelity without increasing GPU cost. This is achieved by training and deploying compact neural networks optimized for the device's hardware.
12+
13+
## How does Arm support neural graphics?
14+
15+
Arm enables neural graphics through the **Neural Graphics Development Kit**: a set of open-source tools that let developers train, evaluate, and deploy ML models for graphics workloads.
16+
17+
At its core are the ML Extensions for Vulkan, which bring native ML inference into the GPU pipeline using structured compute graphs. These extensions (`VK_ARM_tensors` and `VK_ARM_data_graph`) allow real-time upscaling and similar effects to run efficiently alongside rendering tasks.
18+
19+
The neural graphics models can be developed using well-known ML frameworks like **PyTorch**, and exported to deployment using Arm's hardware-aware pipeline. The workflow converts .pt model weights to Vulkan Graph Format (.vgf) via the TOSA intermediate representation, making it possible to do tailored model development for you game use-case. This Learning Path focuses on **Neural Super Sampling (NSS)** as the use case for training, evaluating, and deploying neural models using a toolkit called the **Neural Graphics Model Gym**.
20+
21+
Starting in 2026, Arm GPUs will feature dedicated neural accelerators, optimized for low-latency inference in graphics workloads. To help developers get started early, Arm provides the ML Emulation Layers for Vulkan that simulate future hardware behavior, so you can build and test models now.
22+
23+
To learn more about the Development Kit, check out the [introductory Learning Path](/learning-paths/mobile-graphics-and-gaming/vulkan-ml-sample).
24+
25+
## What is the Neural Graphics Model Gym?
26+
27+
The Neural Graphics Model Gym is an open-source toolkit for fine-tuning and exporting neural graphics models. It is designed to streamline the entire model lifecycle for graphics-focused use cases, like NSS.
28+
29+
Model Gym gives you:
30+
31+
- A training and evaluation API built on PyTorch
32+
- Model export to .vgf for real-time use in game development
33+
- Support for quantization-aware training (QAT) and post-training quantization (PTQ) using ExecuTorch
34+
- Optional Docker setup for reproducibility
35+
36+
The toolkit supports workflows via both Python notebooks (for rapid experimentation) and command-line interface. This Learning Path will walk you through the demonstrative notebooks, and prepare you to start using the CLI for your own model development.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Set up your environment
3+
weight: 3
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
In this section, you will install a few dependencies into your Ubuntu environment. You'll need a working Python 3.10+ environment with some ML and system dependencies. Make sure Python is installed by verifying the version is printed:
10+
11+
```bash
12+
python3 --version
13+
```
14+
15+
Next, install a few additional packages:
16+
17+
```bash
18+
sudo apt update
19+
sudo apt install python3-venv python-is-python3 gcc make python3-dev -y
20+
```
21+
22+
## Set up the examples repository
23+
24+
The example notebooks are open-sourced in a GitHub repository. Start by cloning it:
25+
26+
```bash
27+
git clone https://github.com/arm/neural-graphics-model-gym-examples.git
28+
cd neural-graphics-model-gym-examples
29+
```
30+
31+
From inside the `neural-graphics-model-gym-examples/` folder, run the setup script:
32+
33+
```bash
34+
./setup.sh
35+
```
36+
37+
This will:
38+
- create a Python virtual environment called `nb-env`
39+
- install the `ng-model-gym` package and required dependencies
40+
- download the datasets and weights needed to run the notebooks
41+
42+
Run the following in a python shell to confirm that the script was successful:
43+
44+
```python
45+
import torch
46+
import ng_model_gym
47+
48+
print("Torch version:", torch.__version__)
49+
print("Model Gym version:", ng_model_gym.__version__)
50+
```
51+
52+
You’re now ready to start walking through the training and evaluation steps.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Launch the training notebook
3+
weight: 4
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
In this section, you'll get hands-on with how you can use the model gym to train your own models, or fine-tune the NSS use-case.
10+
11+
## About NSS
12+
13+
Arm Neural Super Sampling (NSS) is an upscaling technique designed to solve a growing challenge in real-time graphics: delivering high visual quality without compromising performance or battery life. Instead of rendering every pixel at full resolution, NSS uses a neural network to intelligently upscale frames, freeing up GPU resources and enabling smoother, more immersive experiences on mobile devices.
14+
15+
The NSS model is available in two formats:
16+
17+
| Model format | File extension | Used for |
18+
|--------------|----------------|--------------------------------------------------------------------------|
19+
| PyTorch | .pt | training, fine-tuning, or evaluation in or scripts using the Model Gym |
20+
| VGF | .vgf | for deployment using Vulkan ML on Arm-based hardware or emulation layers |
21+
22+
Both formats are available in the [NSS repository on Hugging Face](https://huggingface.co/Arm/neural-super-sampling). You'll also be able to explore config files, model metadata, usage details and detailed documentation on the use-case.
23+
24+
Aside from the model in HuggingFace, the Neural Graphics Development Kit features [an NSS plugin for game engines such as Unreal](/learning-paths/mobile-graphics-and-gaming/nss-unreal).
25+
26+
## Run the training notebook
27+
28+
With your environment set up, you're ready to launch the first step in the workflow: training your neural graphics model using the `model_training_example.ipynb` notebook.
29+
30+
{{% notice Before you begin %}}
31+
In this part of the Learning Path, you will run through two Jupyter Notebooks. Return to this tutorial when you're done to explore further resources and next steps.
32+
{{% /notice %}}
33+
34+
You will get familiarized with the following steps:
35+
36+
- Loading a model configuration
37+
- Launching a full training pipeline
38+
- Visualizing metrics with TensorBoard
39+
- Saving intermediate checkpoints
40+
41+
### Start Jupyter Lab
42+
43+
Launch Jupyter Lab with the following command:
44+
45+
```bash
46+
jupyter lab
47+
```
48+
49+
This will prompt you to open your browser to `http://localhost:8888`and enter the token that is printed in the terminal output. Navigate to:
50+
51+
```output
52+
neural-graphics-model-gym-examples/model_training_example.ipynb
53+
```
54+
55+
Step through the notebook for training.
56+
57+
Once your model is trained, the next step is evaluation. You'll measure accuracy, compare checkpoints, and prepare the model for export. Open the evaluation notebook.
58+
59+
```output
60+
neural-graphics-model-gym-examples/model_evaluation_example.ipynb
61+
```
62+
63+
At the end you should see a visual comparison of the NSS upscaling and the ground truth image.
64+
65+
Proceed to the final section to view the model structure and explore further resources.
66+
67+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Visualize your model with Model Explorer
3+
weight: 5
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## What is Model Explorer?
10+
11+
TODO: verify .vgf flavor runs smoothly
12+
13+
Model Explorer is a visualization tool for inspecting neural network structures and execution graphs. Arm provides a VGF adapter for Model Explorer, allowing you to visualize Vulkan Graph Format (`.vgf`) models created from your training and export pipeline.
14+
15+
This lets you inspect model architecture, tensor shapes, and graph connectivity before deployment. This can be a powerful way to debug and understand your exported neural graphics models.
16+
17+
## Setting up the VGF adapter
18+
19+
The VGF adapter extends Model Explorer to support `.vgf` files exported from the Model Gym toolchain.
20+
21+
### Install the VGF adapter with pip
22+
23+
```bash
24+
pip install vgf-adapter-model-explorer
25+
```
26+
27+
Or install the prebuilt wheel from GitHub:
28+
29+
```bash
30+
PYTHON_VERSION_TAG=311
31+
gh release download \
32+
--repo arm/vgf-adapter-model-explorer \
33+
--pattern "*py${PYTHON_VERSION_TAG}*.whl"
34+
pip install *py${PYTHON_VERSION_TAG}*.whl
35+
```
36+
37+
### Install Model Explorer
38+
39+
The next step is to make sure the Model Explorer itself is installed. Use pip to set it up:
40+
41+
```bash
42+
pip install torch ai-edge-model-explorer
43+
```
44+
45+
### Launch the viewer
46+
47+
Once installed, launch the explorer with the VGF adapter:
48+
49+
```bash
50+
model-explorer --extensions=vgf_adapter_model_explorer
51+
```
52+
53+
Use the file browser to open the `.vgf` model exported earlier in your training workflow.
54+
55+
## Wrapping up
56+
57+
Through this Learning Path, you’ve learned what neural graphics is and why it matters for game performance. You’ve stepped through the process of training and evaluating an NSS model using PyTorch and the Model Gym, and seen how to export that model into VGF (.vgf) for real-time deployment. You’ve also explored how to visualize and inspect the model’s structure using Model Explorer.
58+
59+
As a next step, you can head over to the [Model Training Gym repository](https://github.com/arm/neural-graphics-model-gym/tree/main) and explore the documentation to explore integration into your own game development workflow. You’ll find resources on fine-tuning, deeper details about the training and export process, and everything you need to adapt to your own content and workflows.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Fine-Tuning Neural Graphics Models with Model Gym
3+
4+
minutes_to_complete: 45
5+
6+
who_is_this_for: This is an advanced topic for developers exploring neural graphics and interested in training and deploying upscaling models like Neural Super Sampling (NSS) using PyTorch and Arm’s hardware-aware backend.
7+
8+
learning_objectives:
9+
- Understand the principles of neural graphics and how it’s applied to game performance
10+
- Learn how to fine-tune and evaluate a neural network for Neural Super Sampling (NSS)
11+
- Use the Model Gym Python API and CLI to configure and train neural graphics models
12+
- Visualize and inspect models using the Model Explorer tool
13+
14+
prerequisites:
15+
- Basic understanding of PyTorch and machine learning concepts
16+
- A development machine running Ubuntu 22.04, with a CUDA-capable NVIDIA® GPU
17+
- CUDA Toolkit version 11.8 or later
18+
19+
author: Annie Tallund
20+
21+
### Tags
22+
skilllevels: Advanced
23+
subjects: ML, Graphics, Upscaling, PyTorch
24+
armips:
25+
- Mali
26+
tools_software_languages:
27+
- PyTorch
28+
- Jupyter Notebook
29+
- Vulkan
30+
operatingsystems:
31+
- Linux
32+
further_reading:
33+
- resource:
34+
title: Model Gym GitHub Repository
35+
link: https://github.com/arm/neural-graphics-model-gym
36+
type: code
37+
- resource:
38+
title: How Arm Neural Super Sampling works
39+
link: https://community.arm.com/arm-community-blogs/b/mobile-graphics-and-gaming-blog/posts/how-arm-neural-super-sampling-works
40+
type: blog
41+
- resource:
42+
title: Neural Graphics Development Kit
43+
link: https://developer.arm.com/mobile-graphics-and-gaming/neural-graphics
44+
type: website
45+
- resource:
46+
title: NSS Use Case Guide
47+
link: https://developer.arm.com/documentation/111009/latest/
48+
type: documentation
49+
50+
51+
### FIXED, DO NOT MODIFY
52+
weight: 1
53+
layout: "learningpathall"
54+
learning_path_main_page: "yes"
55+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---

0 commit comments

Comments
 (0)