nerfbaselines.backends

class nerfbaselines.backends.ApptainerBackend(spec: ApptainerBackendSpec)[source]

Bases: RemoteProcessRPCBackend

install()[source]
name = 'apptainer'
shell(args=None)[source]
class nerfbaselines.backends.ApptainerBackendSpec[source]

Bases: TypedDict

conda_spec: CondaBackendSpec | None
environment_name: Required[str]
home_path: str
image: str | None
python_path: str
class nerfbaselines.backends.Backend[source]

Bases: object

install()[source]
instance_call(instance: int, method: str, *args, **kwargs)[source]
instance_del(instance: int)[source]
name = 'unknown'
shell(args: Tuple[str, ...] | None = None)[source]
static_call(function: str, *args, **kwargs)[source]
class nerfbaselines.backends.CondaBackend(spec: CondaBackendSpec)[source]

Bases: RemoteProcessRPCBackend

install()[source]
name = 'conda'
shell(args=None)[source]
class nerfbaselines.backends.CondaBackendSpec[source]

Bases: TypedDict

environment_name: Required[str]
install_script: str | None
python_version: str | None
class nerfbaselines.backends.DockerBackend(spec: DockerBackendSpec)[source]

Bases: RemoteProcessRPCBackend

install()[source]
name = 'docker'
shell(args=None)[source]
class nerfbaselines.backends.DockerBackendSpec[source]

Bases: TypedDict

build_script: str
conda_spec: CondaBackendSpec
environment_name: Required[str]
home_path: str
image: str | None
python_path: str
replace_user: bool
class nerfbaselines.backends.SimpleBackend[source]

Bases: Backend

instance_call(instance: int, method: str, *args, **kwargs)[source]
instance_del(instance: int)[source]
name = 'python'
static_call(function: str, *args, **kwargs)[source]
nerfbaselines.backends.backend_allocate(size: int) Tuple[int, memoryview] | None[source]

Allocates a memory block in the shared memory block valid for the next call to the backend. The function is only valid on the worker side handling request. Everywhere else it will return None.

Parameters:

size – The size of the memory block to allocate.

Returns:

If the memory block

was allocated, the function returns a tuple of id and memory view. Otherwise, it returns None.

Return type:

Optional[Tuple[int, memoryview]]

nerfbaselines.backends.backend_allocate_ndarray(shape, dtype)[source]
nerfbaselines.backends.get_backend(method_spec: MethodSpec, backend: str | None) Backend[source]
nerfbaselines.backends.get_implemented_backends(method_spec: MethodSpec) Sequence[Literal['conda', 'docker', 'apptainer', 'python']][source]
nerfbaselines.backends.get_mounts()[source]
nerfbaselines.backends.mount(ps: str | Path, pd: str | Path)[source]
nerfbaselines.backends.run_on_host()[source]
nerfbaselines.backends.zero_copy(zero_copy: bool = True)[source]

A context manager that enables zero-copy for the current thread. Zero-copy is used for all subsequent calls for all backends. A zero-copy mode instructs the backend to reuse the shared memory used for data transfer. This is useful when the data is large and speed is important. However, it is important to only use results of backend calls inside the context manager. The data will be overwritten by subsequent calls.

Parameters:

zero_copy – If True, zero-copy is enabled for the current thread. If False, zero-copy is disabled.