Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion data-gen/kubric/kubric/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class _NumpyEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, np.ndarray):
return o.tolist()
return json.JSONEncoder.default(self, o)
elif isinstance(o, (np.floating,)):
return float(o)
elif isinstance(o, (np.integer,)):
return int(o)
return super().default(o)


def write_png(data: np.array, filename: PathLike) -> None:
Expand Down
1 change: 1 addition & 0 deletions data-gen/kubric/kubric/renderer/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def use_gpu(self) -> bool:
def use_gpu(self, value: bool):
self.blender_scene.cycles.device = "GPU" if value else "CPU"
if value:
bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "CUDA" # or "OPTIX"
# call get_devices() to let Blender detect GPU devices
bpy.context.preferences.addons["cycles"].preferences.get_devices()
devices_used = [d.name for d in bpy.context.preferences.addons["cycles"].preferences.devices
Expand Down