Skip to content
SynthGraph

SDK guides

Assets

Record the scenes, models and textures a generation used or produced.

An asset is a scene, a model, a texture or any other file a generation used or produced. Like a dataset, it is recorded by reference: SynthGraph stores where it lives, never the file.

The examples on this page share this setup:

from synthgraph import SynthGraph

sg = SynthGraph()
experiment = sg.project("Docs: assets").experiment("example")
generation = experiment.generation(generator="blender", generator_version="4.2", seed=1)

Record an asset#

scene = generation.asset(
    name="street-scene.blend",
    uri="s3://lab-bucket/scenes/street-scene.blend",
    type="scene",
    checksum="sha256:" + "cd" * 32,
)
print(scene.id, scene.version)
ArgumentMeaning
nameThe asset's name. Required.
uriWhere the file lives. Required. Stored as text and never opened.
typeA free-text label such as "scene", "model" or "texture".
versionA label for this version. If you leave it out, the current UTC time is used.
checksum, sizeA checksum and a size in bytes, if you have them.
asset_idAdd a new version to an existing asset instead of creating a new one.
roleHow the generation relates to the asset. The default is "output".
metadataAny extra JSON you want stored.

Each call records one immutable version. To record a changed file, call generation.asset(...) again with asset_id= set to the existing asset's id, so the history of that asset stays together.

Unlike datasets, assets have no hashing helper#

The SDK can hash a local dataset for you with compute_checksum=True. It has no such option for assets. If you want a checksum on an asset, compute it yourself and pass checksum=.

When to record assets#

Record the assets that define what a generation could produce: the scene file, the 3D models, the textures, the randomization configuration files. When a result looks wrong later, the scene a generation used is often the first thing you will want to check.