Skip to content

Commit 4a15673

Browse files
authored
Merge pull request #2301 from annietllnd/neural-graphics
Add NSS model training gym LP
2 parents 8c860d1 + 0ffb662 commit 4a15673

File tree

6 files changed

+271
-0
lines changed

6 files changed

+271
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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**](https://developer.arm.com/mobile-graphics-and-gaming/neural-graphics): 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 the model to `.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**](https://github.com/arm/neural-graphics-model-gym). To learn more about NSS, you can check out the [resources on Hugging Face](https://huggingface.co/Arm/neural-super-sampling). Additonally, Arm has developed a set of Vulkan Samples to get started. Specifically, `.vgf` format is introduced in the `postprocessing_with_vgf` one. The Vulkan Samples and over-all developer resources for neural graphics is covered in the [introductory Learning Path](/learning-paths/mobile-graphics-and-gaming/vulkan-ml-sample).
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+
## What is the Neural Graphics Model Gym?
24+
25+
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.
26+
27+
Model Gym gives you:
28+
29+
- A training and evaluation API built on PyTorch
30+
- Model export to .vgf using ExecuTorch for real-time use in game development
31+
- Support for quantization-aware training (QAT) and post-training quantization (PTQ) using ExecuTorch
32+
- Optional Docker setup for reproducibility
33+
34+
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: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 that the version is >3.10:
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+
Activate the virtual environment:
43+
44+
```bash
45+
source nb-env/bin/activate
46+
```
47+
48+
Run the following in a python shell to confirm that the script was successful:
49+
50+
```python
51+
import torch
52+
import ng_model_gym
53+
54+
print("Torch version:", torch.__version__)
55+
print("Model Gym version:", ng_model_gym.__version__)
56+
```
57+
58+
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 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 ML Extensions for Vulkan 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/tutorials/nss/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 located at the following location:
58+
59+
```output
60+
neural-graphics-model-gym-examples/tutorials/nss/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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
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 `.vgf` models created from your training and export pipeline.
12+
13+
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.
14+
15+
## Setting up the VGF adapter
16+
17+
The VGF adapter extends Model Explorer to support `.vgf` files exported from the Model Gym toolchain.
18+
19+
### Install the VGF adapter with pip
20+
21+
```bash
22+
pip install vgf-adapter-model-explorer
23+
```
24+
25+
The source code is available on [GitHub](https://github.com/arm/vgf-adapter-model-explorer).
26+
27+
### Install Model Explorer
28+
29+
The next step is to make sure the Model Explorer itself is installed. Use pip to set it up:
30+
31+
```bash
32+
pip install torch ai-edge-model-explorer
33+
```
34+
35+
### Launch the viewer
36+
37+
Once installed, launch the explorer with the VGF adapter:
38+
39+
```bash
40+
model-explorer --extensions=vgf_adapter_model_explorer
41+
```
42+
43+
Use the file browser to open the `.vgf` model exported earlier in your training workflow.
44+
45+
## Wrapping up
46+
47+
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.
48+
49+
As a next step, you can head over to the [Model Training Gym repository](https://github.com/arm/neural-graphics-model-gym/tree/main) 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 .vgf 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
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: NSS Fine-Tuning Guide
39+
link: https://developer.arm.com/documentation/111141/latest
40+
type: documentation
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 on HuggingFace
47+
link: https://huggingface.co/Arm/neural-super-sampling
48+
type: website
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)